This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/13424] [3.4 Regression] gcc.dg/20031202-1.c is miscompiled
- From: "ebotcazou at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Feb 2004 08:53:03 -0000
- Subject: [Bug optimization/13424] [3.4 Regression] gcc.dg/20031202-1.c is miscompiled
- References: <20031218033126.13424.danglin@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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