소스 검색

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).
Szabolcs Nagy 11 년 전
부모
커밋
929729d430
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/fenv/i386/fenv.s

+ 1 - 1
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)