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 middle-end/46488] [4.5 regression] server/core_filters.c from apache httpd 2.2.17 miscompiled at -O3


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

--- Comment #26 from rguenther at suse dot de <rguenther at suse dot de> 2010-11-29 14:20:45 UTC ---
On Mon, 29 Nov 2010, jorton at redhat dot com wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46488
> 
> --- Comment #25 from Joe Orton <jorton at redhat dot com> 2010-11-29 14:03:40 UTC ---
> (In reply to comment #22)
> > APR_RING_SPLICE_HEAD does such a dereference as far I can see:
> 
> You are right, sorry, I had forgotten exactly how this code works.
> 
> (In reply to comment #24)
> > not really.  But using
> > 
> > typedef struct elem elem_ __attribute__((may_alias));
> > #define APR_RING_SENTINEL(hp, elem, link) \
> >     (struct elem_ *)((char *)(hp) - APR_OFFSETOF(struct elem, link))
> > 
> > would be safe wrt strict aliasing (if the pointer is only dereferenced
> > directly and not casted to another pointer type before, of course).
> 
> I don't think we can guarantee this with the API unchanged; the sentinel
> pointer could well be stored in a "struct elem *" pointer.

You could stick the attribute on the elem struct declaration itself then.

Richard.


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