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

--- Comment #7 from dmitry.v.rogozhkin at intel dot com ---
>> 2. The noted behavior to have 0 values for union members with -O: is that
>> permanent behavior or we can randomly get non-zero values
>If the member is initialized, we should get the correct value.  Otherwise it's 
>undefined behavior.

We get correct value which we tried to initialize on 4.9. But on 4.8 we don't
and there are 2 cases: 1) if we compiled without -O we get random values, 2) if
we compiled with -O, -O1/2/3 we get 0 while we tried to initialize to something
else (to 4 in the example from bug description). I thought that the code change
will shine the light on that, but unfortunately it does not, at least for me.
So, I am trying to understand whether initialization to 0 on 4.8  compiler
under -O option is a permanent behavior or we still may randomly get something
else?

Reply via email to