[Bug middle-end/46488] [4.5 regression] server/core_filters.c from apache httpd 2.2.17 miscompiled at -O3
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Nov 29 14:07:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46488
--- Comment #24 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-29 13:39:02 UTC ---
(In reply to comment #18)
> Using
>
> #define APR_RING_SENTINEL(hp, elem, link) \
> (struct elem *)((char *)(hp) - APR_OFFSETOF(struct elem, link))
>
> should be safer wrt strict aliasing.
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).
More information about the Gcc-bugs
mailing list