PR33749 - Wrong evaluation of expressions in lhs of assignment statements
Paul Richard Thomas
paul.richard.thomas@gmail.com
Fri Oct 12 19:21:00 GMT 2007
This is by way of an appeal...
This bug only appears in -m32 or, rather, it disappears in -m64. What
is odd is that an entire block of code produced by the scalarizer
appears and disappears according to the mode. What is even odder is
that I cannot even figure out how the correct code is ever produced.
This:
integer(4) :: p(4) = (/2,4,1,3/)
p(p) = (/(i, i = 1, 4)/)
print *, p
end
with -m64 produces:
static int4 p[4] = {2, 4, 1, 3};
int4 i;
static int4 options.0[7] = {68, 127, 0, 0, 0, 1, 0};
_gfortran_set_options (7, (void *) &options.0);
{
int8 A.3[4];
struct array1_int8 atmp.2;
static int4 A.1[4] = {1, 2, 3, 4};
atmp.2.dtype = 521;
atmp.2.dim[0].stride = 1;
atmp.2.dim[0].lbound = 0;
atmp.2.dim[0].ubound = 3;
atmp.2.data = (void *) &A.3;
atmp.2.offset = 0;
{
int8 S.4;
S.4 = 0;
while (1)
{
if (S.4 > 3) goto L.1;
(*(int8[0:] *) atmp.2.data)[S.4] = (int8) p[S.4];
S.4 = S.4 + 1;
}
L.1:;
}
{
int8 S.5;
S.5 = 0;
while (1)
{
if (S.5 > 3) goto L.2;
{
int8 D.875;
D.875 = (*(int8[0:] *) atmp.2.data)[S.5];
p[D.875 + -1] = A.1[S.5];
}
S.5 = S.5 + 1;
}
L.2:;
}
}
........+ the io.....
but the block that produces D.875 goes away in -m32 mode, so that the
assignment becomes, incorrectly:
D.513 = (*(int4[0:] *) parm.2.data)[parm.2.dim[0].stride *
NON_LVALUE_EXPR <S.3>];
p[D.513 + -1] = A.1[S.3];
an anybody cast any light on this? It's driving me bonkers...
Paul
--
The knack of flying is learning how to throw yourself at the ground and miss.
--Hitchhikers Guide to the Galaxy
More information about the Fortran
mailing list