This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/33088] [4.1/4.2/4.3 Regression] spurious exceptions with -ffloat-store
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Aug 2007 10:37:37 -0000
- Subject: [Bug middle-end/33088] [4.1/4.2/4.3 Regression] spurious exceptions with -ffloat-store
- References: <bug-33088-230@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from joseph at codesourcery dot com 2007-08-17 10:37 -------
Subject: Re: [4.1/4.2/4.3 Regression] spurious exceptions
with -ffloat-store
On Fri, 17 Aug 2007, pinskia at gcc dot gnu dot org wrote:
> For one, I don't think " __real__ X = R; __imag__ X = C; " is really nice
> looking. Now if the person did:
> *(double*) &X = R; ((double*) & X)[1] = C;
>
> it might be a different story but then again X is still defined piece wise so
> you will still get NaN.
I think setting parts is cleaner than using casts like that, and safer
(because of not involving arithmetic that GCC's liable to get wrong in
cases involving -0) than R + C * I.
> I really don't think this is a bug as we have an uninitialized variables here
> in the same way doing:
> short a;
> a = b&0xff|a;
> a = (b<<8)&0xFF00|a;
>
> Would be defined code.
I think setting the parts is valid GNU C (ISO C doesn't have the __real__
and __imag__ operators), and should be considered much like initializing a
struct by parts, where it would definitely be incorrect to generate an
exception from an uninitialized part.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33088