[Bug middle-end/46488] [4.5 regression] server/core_filters.c from apache httpd 2.2.17 miscompiled at -O3
jorton at redhat dot com
gcc-bugzilla@gcc.gnu.org
Mon Nov 29 14:31:00 GMT 2010
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.
More information about the Gcc-bugs
mailing list