about summary refs log tree commit diff
path: root/src/fenv
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2014-02-09 18:19:03 +0100
committerSzabolcs Nagy <nsz@port70.net>2014-02-09 18:19:03 +0100
commit929729d4307e28d7023fbee2b727a56fc34b744c (patch)
treec3c430f43bd47f8bc4bd1beadea00d70deae906e /src/fenv
parent758ab35a167ac17a4e3102cee5d16b75053842a7 (diff)
downloadmusl-929729d4307e28d7023fbee2b727a56fc34b744c.tar.gz
musl-929729d4307e28d7023fbee2b727a56fc34b744c.tar.xz
musl-929729d4307e28d7023fbee2b727a56fc34b744c.zip
fix fesetenv(FE_DFL_ENV) on i386
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).
Diffstat (limited to 'src/fenv')
-rw-r--r--src/fenv/i386/fenv.s2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/fenv/i386/fenv.s b/src/fenv/i386/fenv.s
index f6036d67..a189ca2e 100644
--- a/src/fenv/i386/fenv.s
+++ b/src/fenv/i386/fenv.s
@@ -126,7 +126,7 @@ fesetenv:
 	push %eax
 	push %eax
 	push %eax
-	push %eax
+	pushl $0xffff
 	push %eax
 	pushl $0x37f
 	fldenv (%esp)