------- Comment #4 from domob at gcc dot gnu dot org  2008-09-07 14:46 -------
     parm.12.dim[0].ubound = D.1541;
     parm.12.dim[0].stride = NON_LVALUE_EXPR <D.1546>;
     parm.12.data = (void *) &(*ifm.11)[0];
     parm.12.offset = NON_LVALUE_EXPR <D.1545>;
     D.1547 = MAX_EXPR <(parm.12.dim[0].ubound - parm.12.dim[0].lbound) + 1,
0>;
-    D.1548 = D.1547 + -1;
+    D.1548 = D.1547 + -2;
     atmp.13.dtype = 281;
     atmp.13.dim[0].stride = 1;
     atmp.13.dim[0].lbound = 0;
     atmp.13.dim[0].ubound = D.1548;

This one (from the diffs on my machine) is the problematic one.  The value
subtracted should be -1 independently of the lower bound.  D.1548 will later be
used in calculating the size of the temporary allocated, and for a lower-bound
of 2, for instance, one element will be missing (for lower-bound 3 it would be
2 elements).

I'm not yet completely sure what the problem is for a lower bound of 0 or -1,
though.  There, too much memory is allocated and the atmp's (the result
array's) upper bound is too large.  But I'll try to locate the problem in
gfortran now and fix it and see what this does for all kinds of bounds.


-- 


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

Reply via email to