This is the mail archive of the gcc-bugs@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]

Re: aliasing nastiness


On Fri, Jan 14, 2000 at 10:45:14PM +0100, Martin v. Loewis wrote:

> > 	double tmp = *(double*)buffer;

> If you provide the same bytes in buffer on Linux/x86 and Win9x, you
> should get the same values. If you use Linux/Sparc, you'll get a
> different value due to endianness.

This is sortof true. VC generates a series of mov instructions to
literally move bytes into the value, while gcc appears to use the
floating point instructions to load/store the value.

Initially we thought there was a problem in this instruction, but it
appears that there is actually a problem in fprintf() for the two
platforms, related to rounding issues, as the binary information in
the double appears to be exact for both.

The different instruction generation is puzzling, though.

m.

-- 
Programmer                         "I wrote a song about dental floss,
Loki Entertainment Software         but did anyone's teeth get cleaner?"
http://lokigames.com/~briareos/              - Frank Zappa, re: the PMRC

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