This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: issues with doubles and -fno-schedule-insns2
- From: "Dave Korn" <dk at artimi dot com>
- To: <mfletcher at serck-controls dot co dot uk>,<gcc at gcc dot gnu dot org>
- Date: Fri, 26 Nov 2004 14:16:14 -0000
- Subject: 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....