http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46488
Joe Orton <jorton at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jorton at redhat dot com --- Comment #19 from Joe Orton <jorton at redhat dot com> 2010-11-29 11:02:26 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. We changed the macro from that to the current definition to avoid strict aliasing warnings from gcc: http://svn.apache.org/viewvc?view=revision&revision=662299 Does the cast through a char * not have the desired effect of allowing the pointer to alias any other pointer regardless of type? That is one of the exceptions in C99 6.5/par 7. Why specifically does this result in an C99 aliasing violation anyway? The pointers to which this macro evaluates are never dereferenced, only compared for equality.