This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/21666] Optimization level -O2 breaks float (double) conversion
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 May 2005 21:34:44 -0000
- Subject: [Bug c/21666] Optimization level -O2 breaks float (double) conversion
- References: <20050519183504.21666.jbeitaharon@intrusic.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-19 21:34 -------
(In reply to comment #2)
> Subject: Re: Optimization level -O2 breaks float (double) conversion
>
> Dear Pinski and Co.,
> As a former compiler developer myself I was just trying to help, and I'm
> sorry to tell you that your answer was not to the point.
The code is undefined by the C standard so we could compile it to make your hardware unusable after
you execute that code (yes I am joking but that is what the C standard allows us to do). read http://
gcc.gnu.org/bugs.html and the explication on that page about this commonly reported bug.
You can either workaround it by using -fno-strict-aliasing or using an union. And yes the compiler
does generate a warning with -Wstrict-aliasing (which is included with -Wall).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21666