[Bug c++/20607] [3.4 Regression] -fstrict-aliasing causes incorrect scheduling

ebotcazou at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Mar 30 10:53:00 GMT 2005


------- 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?


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|ebotcazou at gcc dot gnu dot|mark at codesourcery dot com
                   |org                         |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20607



More information about the Gcc-bugs mailing list