------- Comment #4 from fxcoudert at gcc dot gnu dot org  2006-10-10 22:04 
-------
(In reply to comment #3)
> Are you sure that this renormalization of the bounds is required? After all:
> (i) indices should always be realtive to lbound, whatever it is; and
> (ii) why would anybody be interested to do this?  After all, the temporary
> could be assigned to a variable with any lbound at all.

I'm not sure I understand. The following code:
  INTEGER :: I(-1:1,-1:1)=0
  WRITE(6,*) LBOUND(I)
  WRITE(6,*) LBOUND(I(:,:))
  WRITE(6,*) LBOUND(TRANSPOSE(I))
  END
ought to output
  -1 -1
  1 1
  1 1
and not like we currently do:
  -1 -1
  1 1
  -1 -1

That's because of F95 13.14.53:

Case (i): For an array section or for an array expression other than a whole
array or array structure component, LBOUND(ARRAY, DIM) has the value 1.  For a
whole array or array structure component, LBOUND(ARRAY, DIM) has the value:
    (a) equal to the lower bound for subscript DIM of ARRAY if dimension DIM of
ARRAY does not have extent zero or if ARRAY is an assumed-size array of rank
DIM, or 
    (b) 1 otherwise.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29391

Reply via email to