[Bug fortran/35698] lbound and ubound wrong for allocated run-time zero size array

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Mar 25 23:52:00 GMT 2008



------- Comment #1 from burnus at gcc dot gnu dot org  2008-03-25 23:52 -------
Thanks for testing/reducing/reporting this.

If one looks at the bounds, one sees that for negative lower bounds the output
is wrong. NAG correctly has:
   2   1   0   1  -2  -3  -4
   3   4   5   0   7   8   9
while gfortran wrongly has:
   2   1   0   1   1   1   1
   3   4   5   0   0   0   0

ila1[S.2 + -1] = lla.dim[S.2 + -1].stride >= 0 && lla.dim[S.2 + -1].ubound >=
lla.dim[S.2 + -1].lbound || lla.dim[S.2 + -1].stride < 0 && lla.dim[S.2 +
-1].ubound <= lla.dim[S.2 + -1].lbound ? (integer(kind=4)) lla.dim[S.2 +
-1].lbound : 1;

This looks ok. However, I do not understand the stride calculation:

    lla.dim[3].lbound = (integer(kind=8)) nf10;
    lla.dim[3].ubound = 1;
    lla.dim[3].stride = 48;

so far so good, but why the following?

    D.950 = (2 - (integer(kind=8)) nf10) * 48;
    lla.dim[4].lbound = -2;
    lla.dim[4].ubound = 7;
    lla.dim[4].stride = D.950;

D.950 is (2-10)*48 = -384 ?!?!?


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |32834
              nThis|                            |
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2008-03-25 23:52:07
               date|                            |


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



More information about the Gcc-bugs mailing list