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