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

Reply via email to