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 c++/34459] [4.1/4.3 Regression] incorrect code when compiled with optimization (-O1)



------- Comment #3 from jakub at gcc dot gnu dot org  2007-12-17 15:08 -------
C testcase:

extern void abort (void);
extern void *memset (void *s, int c, __SIZE_TYPE__ n);

struct S
{
  char s[25];
};

void __attribute__((noinline))
foo (struct S *x)
{
  int i;
  for (i = 0; i < sizeof (x->s); ++i)
    if (x->s[i] != 0)
      abort ();
}

int
main ()
{
  struct S a;
  memset (&a.s, '\0', sizeof (a.s));
  foo (&a);
  struct S b = a;
  b = b;
  foo (&b);
  return 0;
}

Weird that nothing removed the noop move earlier, shouldn't that be a job at
least for DCE?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34459


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