math.floats.env.x86: more direct test for stack fault detection

db4
Joe Groff 2010-08-13 22:19:54 -07:00
parent 0701a68760
commit 7384793287
1 changed files with 7 additions and 14 deletions

View File

@ -1,21 +1,14 @@
USING: math.floats.env math.floats.env.x86 tools.test
alien.c-types alien.syntax classes.struct compiler.test
math kernel sequences ;
classes.struct cpu.x86.assembler cpu.x86.assembler.operands
compiler.test math kernel sequences alien alien.c-types ;
IN: math.floats.env.x86.tests
! the sqrtl function is really long double sqrtl ( long double x )
! calling it as if it had a void return leaves the return value on
! the x87 stack, so 9 calls will be guaranteed to cause a stack
! fault
STRUCT: fake-long-double { x char[20] } ;
FUNCTION-ALIAS: busted-sqrtl
void sqrtl ( fake-long-double x ) ;
[ t ] [
[
[
9 [ fake-long-double <struct> busted-sqrtl ] times
] collect-fp-exceptions
] compile-call
[ [
void { } cdecl [
9 [ FLDZ ] times
] alien-assembly
] compile-call ] collect-fp-exceptions
+fp-x87-stack-fault+ swap member?
] unit-test