------- Additional Comments From mark at codesourcery dot com 2005-03-31 00:54 ------- Subject: Re: [3.4 Regression] -fstrict-aliasing causes incorrect scheduling
ebotcazou at gcc dot gnu dot org wrote: > ------- Additional Comments From ebotcazou at gcc dot gnu dot org 2005-03-30 > 10:53 ------- > Hum... type-punning simply doesn't work in this case with the C++ compiler, > but > does work with the C compiler. The problem is that: > > union u { > x_uint64_t first; > x_uint32_t second; > }; > union u conv; > conv.first = arg1; > result = conv.second; > > is translated into: > > *(&conv.first) = *(&arg1); > *(&result) = *(&conv.second); > > and type-punning cannot work in this case (that's the counter-example provided > in the manual). I guess the problem comes the fields being of aggregate > types. > > Mark, is that fixable or should we document the limitation? I think it's fixable. I'm not sure exactly why the C++ front-end is inserting the additional operations, but they're certainly not essential from a C++ semantics point of view. Please reassign the bug to me; I'll try to take a look. Thanks, -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20607