This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/24424] New: Equivalence broken since 20051013
- From: "paul dot richard dot thomas at cea dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Oct 2005 08:42:30 -0000
- Subject: [Bug fortran/24424] New: Equivalence broken since 20051013
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This test, which is reduced from a test that Jakub reduced from the Polyhedron
test_fpu.f90, segfaults in execution.
integer, dimension (8388608) :: i, j, k
equivalence (i(1), j(10))
i = 5
k = i
end
$ /irun/bin/gfortran -fmax-stack-var-size=1000000 JAKUBS_TEST.f90
THOMASP@PC-THOMAS-P /cygdrive/d/gfortran/pb04/lin/f90
$ ./a
Segmentation fault (core dumped)
It does this for any optimization/options that I have tried.
The code produced is
MAIN__ ()
{
static union
{
int4 j[8388608];
int4 i[8388608];
} equiv.0;
static int4 j[8388608];
static int4 i[8388608];
static int4 k[8388608];
{
int4 S.0;
S.0 = 1;
while (1)
{
if (S.0 > 8388608) goto L.1; else (void) 0;
i[NON_LVALUE_EXPR <S.0> + -1] = 5;
S.0 = S.0 + 1;
}
L.1:;
}
{
int4 S.1;
S.1 = 1;
while (1)
{
if (S.1 > 8388608) goto L.2; else (void) 0;
k[NON_LVALUE_EXPR <S.1> + -1] = i[NON_LVALUE_EXPR <S.1> + -1];
S.1 = S.1 + 1;
}
L.2:;
}
}
whereas a working version of gfortran produces
MAIN__ ()
{
static union
{
int4 j[8388608];
int4 i[8388608];
} equiv.0;
static int4 k[8388608];
{
int4[8388608] * D.481;
D.481 = &equiv.0.i;
{
int4 S.0;
S.0 = 1;
while (1)
{
if (S.0 > 8388608) goto L.1; else (void) 0;
(*D.481)[NON_LVALUE_EXPR <S.0> + -1] = 5;
S.0 = S.0 + 1;
}
L.1:;
}
}
{
int4[8388608] * D.484;
D.484 = &equiv.0.i;
{
int4 S.1;
S.1 = 1;
while (1)
{
if (S.1 > 8388608) goto L.2; else (void) 0;
k[NON_LVALUE_EXPR <S.1> + -1] = (*D.484)[NON_LVALUE_EXPR <S.1> + -1];
S.1 = S.1 + 1;
}
L.2:;
}
}
}
Notice the appearance in the broken version of non-union static arrays for i
and j, which are what the subsequent code refers to. I understand from the
list that this is not what it appears to be but.... looks, walks and squits
like a duck to me!
Paul T
--
Summary: Equivalence broken since 20051013
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: paul dot richard dot thomas at cea dot fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24424