This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20607] [3.4 Regression] -fstrict-aliasing causes incorrect scheduling
- From: "ebotcazou at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Mar 2005 10:53:21 -0000
- Subject: [Bug c++/20607] [3.4 Regression] -fstrict-aliasing causes incorrect scheduling
- References: <20050323190354.20607.Ganesh.Sittampalam@arm.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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