This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug optimization/13424] [3.4 Regression] gcc.dg/20031202-1.c is miscompiled


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]