The perennial i386 floating-point rounding issue...
Toon Moene
toon@moene.indiv.nluug.nl
Mon Jun 17 09:08:00 GMT 2002
Zack Weinberg wrote:
> I believe I saw this go by again just a few days back, but I can't
> find it anymore. Anyhow, while digging through C99 for something else
> I found this paragraph:
>
> 5.1.2.3p12
> EXAMPLE 4 Implementations employing wide registers have to take care
> to honor appropriate semantics. Values are independent of whether
> they are represented in a register or in memory. For example, an
> implicit spilling of a register is not permitted to alter the value.
>
> This sure sounds like we are required to do 80-bit spills, if we use
> the extended precision mode.
No, the error rests with the i386 backend. It accepts register DFmode
allocations, which is bogus, because it cannot guarantee DFmode
behaviour when pseudo's are allocated to "real" i387 registers (i.e.,
stack slots).
A programmer writing:
DOUBLE PRECISION X, Y, Z
READ*, X, Y
Z = X * Y
PRINT*, Z
END
is asking for DFmode behaviour, because that's the mapping between
DOUBLE PRECISION and what the backend supports, not some funky XFmode
behaviour that sometimes occurs and sometimes doesn't, depending on
optimization levels and compiler cleverness.
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)
More information about the Gcc
mailing list