fix fesetenv(FE_DFL_ENV) on i386
authorSzabolcs Nagy <nsz@port70.net>
Sun, 9 Feb 2014 17:19:03 +0000 (18:19 +0100)
committerSzabolcs Nagy <nsz@port70.net>
Sun, 9 Feb 2014 17:19:03 +0000 (18:19 +0100)
the default fenv was not set up properly, in particular the
tag word that indicates the contents of the x87 registers was
set to 0 (used) instead of 0xffff (empty)

this could cause random crashes after setting the default fenv
because it corrupted the fpu stack and then any float computation
gives NaN result breaking the program logic (usually after a
float to integer conversion).

src/fenv/i386/fenv.s

index f6036d6..a189ca2 100644 (file)
@@ -126,7 +126,7 @@ fesetenv:
        push %eax
        push %eax
        push %eax
-       push %eax
+       pushl $0xffff
        push %eax
        pushl $0x37f
        fldenv (%esp)