------- Comment #13 from sgk at troutmask dot apl dot washington dot edu 2009-11-15 19:26 ------- Subject: Re: [4.5/4.4 Regression] data statement with nested type constructors
On Sun, Nov 15, 2009 at 07:04:42PM -0000, jvdelisle at gcc dot gnu dot org wrote: > > > ------- Comment #12 from jvdelisle at gcc dot gnu dot org 2009-11-15 19:04 > ------- > When we simplify start[i], we turn that expression into a constant. Then I > believe the traverse_data_var can no longer increment the index since we made > it a constant. I don't think the start[i] expression should be used to > increment the offset, but I think it is. I am wondering if we don't need a > temporary expression to use for this to traverse for the offset. Still > thinking > ... > Changed the instrumentaion of the code a little. In the for-loop of get_array_index, I added printf("i = %d --> ", i); gmp_printf ("start = %Zd ", e->value.integer); gmp_printf ("lower = %Zd ", ar->as->lower[i]->value.integer); gmp_printf ("upper = %Zd ", ar->as->upper[i]->value.integer); gmp_printf ("offset= %Zd\n", *offset); REMOVE:kargl[252] gfc4x -o z pr41807.f90 -fdump-tree-original i = 0 --> start = 1 lower = 1 upper = 3 offset= 0 i = 0 --> start = 2 lower = 1 upper = 3 offset= 1 i = 0 --> start = 3 lower = 1 upper = 3 offset= 2 i = 0 --> start = 1 lower = 1 upper = 3 offset= 0 i = 0 --> start = 0 lower = 1 upper = 3 offset= -1 i = 0 --> start = 0 lower = 1 upper = 3 offset= -1 The first 3 lines are from data (z(i), i = 1, n) / 1, 2, 3/ with z integer. The next 3 are from the array of derived type b. So, you appear to be on the right track. The start value appears to be junk. What's disconcerting is that the dump shows (with the check for /*|| (gfc_is_constant_expr (e) == 0)*/ disabled) REMOVE:kargl[253] more pr41807.f90.003t.original MAIN__ () { static struct a b[3] = {{.x={7.0e+0, 8.0e+0, 9.0e+0}}, {.x={1.0e+0, 2.0e+0, 3.0e+0}}}; integer(kind=4) i; static integer(kind=4) z[3] = {1, 2, 3}; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41807