Van Snyder wrote: > > People have observed that > > A(:) = B(:) > > sometimes creates a temp before doing the assignment, and is therefore > slow, and may cause a stack overflow. > > Does this happen with contemporary compilers, or just old ones? You are probably refering to Peter Shenkin's realloc example yesterday, in which he had > p2( 1:nalloc ) = p( 1:nalloc ) !******** SEGV here *************** and discovered the SEGV was due to the creation of a temp. In his example, p and p2 are both pointers. My guess is that a compiler cannot avoid a temp in this situation without a lot of compilicated dependency analysis. Suppose p2 => a(2:n) and p => a(1:n-1). The obvious translation of the array statement to a DO loop does not give the expected results. Granted, in the case that Peter gave, where p2 was allocated a couple statements before this assignment, the compiler could easily have determined that there was no dependency. So I'd agree with Peter that this is really a QofI issue. It's a matter of how many special cases the compiler wants to look for during optimization. I took this example to be an example of a situation where you pay a performance penalty to use pointers. Bill -- William F. Mitchell Mathematical and Computational Sciences Division National Institute of Standards and Technology [log in to unmask] http://math.nist.gov/~mitchell %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%