This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/29272] [4.2 Regression] memcpy optimization causes wrong-code
- 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: 29 Sep 2006 22:04:38 -0000
- Subject: [Bug middle-end/29272] [4.2 Regression] memcpy optimization causes wrong-code
- References: <bug-29272-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from jakub at gcc dot gnu dot org 2006-09-29 22:04 -------
Is:
extern void abort (void);
struct S { struct S *s; } s;
struct T { struct T *t; } t;
static inline void
foo (void *s)
{
struct T *p = s;
__builtin_memcpy (&p->t, &t.t, sizeof (t.t));
}
void *
__attribute__((noinline))
bar (void *p, struct S *q)
{
q->s = &s;
foo (p);
return q->s;
}
int
main (void)
{
t.t = &t;
if (bar (&s, &s) != (void *) &t)
abort ();
return 0;
}
valid? I'd say yes, we either access s.s using its declared (== effective)
type,
or through memcpy (which is supposed tobe a char array access and therefore
ok wrt. aliasing).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29272