This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: issues with doubles and -fno-schedule-insns2


> -----Original Message-----
> From: gcc-owner On Behalf Of Matthew J Fletcher
> Sent: 26 November 2004 14:07

> in all cases are am hosted and targeting on i386.

> void test(void)
> {	
> 	unsigned int Value[2] = { 0x7FF00000, 0x7FF00000 };
> 	double *ValueD = (double *)&Value[0];
> 	
> 	// (*ValueD) should be "nan"
> }

> a small modification to the code to,..
> 
> unsigned int Value[2] = { 0x7FF00000, 0x7FF00000 };
> 
> void test(void)
> {	
> 	double *ValueD = (double *)&Value[0];
> 	
> 	// (*ValueD) should be "nan"
> }
> 
> and all the above compiler combinations work.
> 
> am i doing something wrong ?


  What's the natural alignment required for a double type on i386?

  My guess would be that the static array gets aligned correctly and the one
on the stack doesn't.  That's (just one of) the (many) reason(s) why
type-punning is bad.

    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]