Skip to content

build: Compile with `-ffloat-store` on x86 (32 bit)

Iain Lane requested to merge wip/laney/ffloat-store-x86 into master

GCC's manpage says that this flag does the following:

Do not store floating-point variables in registers, and inhibit other options that might change whether a floating-point value is taken from a register or memory.

This option prevents undesirable excess precision on machines such as the 68000 where the floating registers (of the 68881) keep more precision than a "double" is supposed to have. Similarly for the x86 architecture. For most programs, the excess precision does only good, but a few programs rely on the precise definition of IEEE floating point.

We rely on this behaviour in our fork of clutter. When performing floating point computations on x86, we are getting the wrong results because of this architecture's use of the CPU's extended (x87, non-IEEE confirming) precision by default. If we enable -ffloat-store here, then we'll get the same results everywhere by storing into variables instead of registers. This does not remove the need to be correct when handling floats, but it does mean we don't need to be more correct than the IEEE spec requires.

Merge request reports