[Bug optimization/13424] [3.4 Regression] gcc.dg/20031202-1.c is miscompiled
ebotcazou at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Feb 23 08:53:00 GMT 2004
------- Additional Comments From ebotcazou at gcc dot gnu dot org 2004-02-23 08:52 -------
Then let's reopen, but unassign from Jakub because he has done his part.
The testcase doesn't fail anymore on SPARC, but here's another one that fails:
/* { dg-options "-O2 -mcpu=ultrasparc" } */
struct S {
const int i1;
const long l1;
const int i2;
const long l2;
int i3;
int i4;
};
extern void abort(void);
void bar (struct S *s)
{
if (s->i3 != 2)
abort();
}
int main(void)
{
struct S s = { 0, 0, 0, 0 };
s.i3 = 2;
bar(&s);
return 0;
}
The problem is that the /u flag is put on a SET to a MEM during clearing, but
not during the subsequent assignment, and the scheduler swaps the two SETs.
It appears that the clearing optimization is not safe in presence of readonly
fields; now, if we disable it, we have a pessimization for structures with const
members over structures without const members. Really tricky...
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13424
More information about the Gcc-bugs
mailing list