https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88223

--- Comment #10 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
On Wed, 28 Nov 2018, rguenth at gcc dot gnu.org wrote:

> Hmm, OTOH the C standard specifies that the store to u.b.b makes it the
> u.b the active member and it makes the old contents undefined.  That
> would mean when loading u.a.b after the store we cannot rely on the
> exact value we get but at least the bits touched by u.b.b should be
> up-to-date (which is enough to show breakage).  I thought about
> using

In my view, storing to u.b.b should be equivalent to loading u.b (a 
type-punning operation if u.a was previously the active member), storing 
the new value of u.b.b in a copy of the loaded value of u.b, and storing 
that result back in u.b (making u.b the active member of u).  (So if bits 
set in u.a are not padding in u.b, and not part of the space occupied by 
u.b.b, they should be preserved.)

Reply via email to