------- Comment #9 from rguenther at suse dot de  2006-09-30 11:46 -------
Subject: Re:  [4.2 Regression] memcpy optimization
 causes wrong-code

On Sat, 29 Sep 2006, pinskia at physics dot uc dot edu wrote:

> ------- Comment #7 from pinskia at physics dot uc dot edu  2006-09-29 22:13 
> -------
> Subject: Re:  [4.2 Regression] memcpy optimization causes wrong-code
> > ------- 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));
> 
> I think the problem is really is &p->t include an access or not?
> I know if p is NULL, this is undefined as &p->t is now have a NULL pointer
> access but does that include using memcpy?

If you write it as memcpy (p, &t, ...) then it is ok.  Now I think
by applying common sense 6.5.3.2/3 can be applied to &p->t, too.


-- 


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

Reply via email to