http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46488
--- Comment #17 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2010-11-28
12:28:27 UTC ---
It appears that inlining brigade_move into ap_core_input_filter and
ap_core_output_filter at -O3 causes (one of) the latter functions to be
miscompiled with -fstrict-aliasing.
The code uses clever type punning which seems to break C aliasing rules:
/**
* The Ring Sentinel
*
* This is the magic pointer value that occurs before the first and
* after the last elements in the ring, computed from the address of
* the ring's head. The head itself isn't an element, but in order to
* get rid of all the special cases when dealing with the ends of the
* ring, we play typecasting games to make it look like one.
[...]
#define APR_RING_SENTINEL(hp, elem, link) \
(struct elem *)((char *)(&(hp)->next) - APR_OFFSETOF(struct elem, link))
(hp)->next is struct elem* but it is accessed (its link field) as a struct elem
through various macros:
#define APR_RING_NEXT(ep, link) (ep)->link.next
#define APR_RING_PREV(ep, link) (ep)->link.prev