This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34459] [4.1/4.3 Regression] incorrect code when compiled with optimization (-O1)
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Dec 2007 15:08:13 -0000
- Subject: [Bug c++/34459] [4.1/4.3 Regression] incorrect code when compiled with optimization (-O1)
- References: <bug-34459-15519@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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