[Patch, fortran] PR52012 - [4.6/4.7 Regression] Wrong-code with realloc on assignment and RESHAPE w/ ORDER=

Paul Richard Thomas paul.richard.thomas@gmail.com
Thu Feb 2 09:14:00 GMT 2012


Dear Dominique and Tobias,

I am a little concerned about this:\
   real, dimension(:,:), allocatable :: tmp
   tmp = matmul(a,b)
   if (any (lbound (tmp) .ne. [1,1])) call abort

>> As "tmp" is a local variable, it is unallocated until the assignment. Thus,
>> it should get as lower bound  "lbound(rhs-expr)", which is [1,1]. But currently
>> it has result "[0, 0]".

I would agree with you if the test were if (any (lbound (tmp(:)) .ne.
[1,1])) call abort.  However, for a full array, as in the testcase,
the lbound should be that returned by matmul.  For an unallocated
result, this is zero.

Cheers

Paul



More information about the Fortran mailing list