DR#236 analysis
Geoffrey Keating
geoffk@geoffk.org
Fri Dec 3 07:13:00 GMT 2004
"Joseph S. Myers" <joseph@codesourcery.com> writes:
> An analysis of C99 DR#236 (type-based alias rules in the presence of
> unions) with a possible resolution with a note "Optimizers may have
> problems here" has been posted in the posted in the post-Redmond mailing
> <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1090.htm>; I'd suggest
> people trying to implement aliasing rules read it. Any comments about
> what resolutions make sense for optimizing real code would probably best
> go to the WG14 reflector (sc22wg14 at open-std.org) though I don't know to
> what extent non-member postings are accepted.
I prefer the n980 proposal instead, require a visible union. If it's
felt that's too unhelpful for optimisers, the alternative I'd suggest,
which I like but am not sure about incompatibility with existing code,
would be to say that pointers to (or inside) fields of a union become
invalid on a store to a different field (as would happen if the other
fields were free()ed). For malloc-ed memory, I strongly support the
idea that the first store should determine its type and the type can't
change after that.
More information about the Gcc
mailing list