https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114030
--- Comment #3 from absoler at smail dot nju.edu.cn --- (In reply to Andrew Pinski from comment #1) > Reduced testcase: > ``` > union U0 { > int f2; > char f4; > }; > > int g_3; > union U0 g_34 = {-1L}; > char func_1() { > int t11 = g_34.f2; > char t1 = g_34.f4; > g_3 = t11; > return t1; > } > ``` > > This is just due to unions. I am not sure if this is important to optimize > really since techincally the original code is undefined by the C/C++ > standard (though GCC does an extension which makes it defined). Unions used > in this way is not used much either. reading different field of a union seems defined in C11 standard (maybe not in C++11). "If the member used to read the contents of a union object is not the same as the member last used to store a value in the object, the appropriate part of the object representation of the value is reinterpreted as an object representation in the new type as described in 6.2.6 (a process sometimes called ‘type punning’). This might be a trap representation."