summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormiod <>2007-10-22 21:07:10 +0000
committermiod <>2007-10-22 21:07:10 +0000
commit744bfb5fee0dbac6a1a2189140e8d871d8542065 (patch)
treeaa43d847103ed298d902113b094a87651b6c24f9 /src
parentf3fcdb0a92dbfed3956fed57bb7bc2715f06944c (diff)
downloadopenbsd-744bfb5fee0dbac6a1a2189140e8d871d8542065.tar.gz
openbsd-744bfb5fee0dbac6a1a2189140e8d871d8542065.tar.bz2
openbsd-744bfb5fee0dbac6a1a2189140e8d871d8542065.zip
Only test one condition per invocation flavour, instead of testing all
of them with exceptions disabled and then only one with exceptions enabled. ok kettenis@
Diffstat (limited to 'src')
-rw-r--r--src/regress/lib/libc/ieeefp/except/except.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/src/regress/lib/libc/ieeefp/except/except.c b/src/regress/lib/libc/ieeefp/except/except.c
index 1d11877777..0f25cadefc 100644
--- a/src/regress/lib/libc/ieeefp/except/except.c
+++ b/src/regress/lib/libc/ieeefp/except/except.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: except.c,v 1.10 2006/05/15 14:00:22 kettenis Exp $ */ 1/* $OpenBSD: except.c,v 1.11 2007/10/22 21:07:10 miod Exp $ */
2 2
3#include <sys/types.h> 3#include <sys/types.h>
4#include <unistd.h> 4#include <unistd.h>
@@ -55,42 +55,44 @@ main(int argc, char *argv[])
55 sigaction(SIGFPE, &sa, NULL); 55 sigaction(SIGFPE, &sa, NULL);
56 signal_status = 1; 56 signal_status = 1;
57 57
58 /* trip divide by zero */
59 x = one / zero;
60 assert(fpgetsticky() & FP_X_DZ);
61 fpsetsticky(0);
62
63 /* trip invalid operation */
64 x = zero / zero;
65 assert(fpgetsticky() & FP_X_INV);
66 fpsetsticky(0);
67
68 /* trip overflow */
69 x = huge * huge;
70 assert(fpgetsticky() & FP_X_OFL);
71 fpsetsticky(0);
72
73 /* trip underflow */
74 x = tiny * tiny;
75 assert(fpgetsticky() & FP_X_UFL);
76 fpsetsticky(0);
77
78 signal_status = 0;
79
80 if (strcmp(argv[1], "fltdiv") == 0) { 58 if (strcmp(argv[1], "fltdiv") == 0) {
81 /* unmask and then trip divide by zero */ 59 /* trip divide by zero */
60 x = one / zero;
61 assert(fpgetsticky() & FP_X_DZ);
62 fpsetsticky(0);
63
64 /* and now unmask to get a signal */
65 signal_status = 0;
82 fpsetmask(FP_X_DZ); 66 fpsetmask(FP_X_DZ);
83 x = one / zero; 67 x = one / zero;
84 } else if (strcmp(argv[1], "fltinv") == 0) { 68 } else if (strcmp(argv[1], "fltinv") == 0) {
85 /* unmask and then trip invalid operation */ 69 /* trip invalid operation */
70 x = zero / zero;
71 assert(fpgetsticky() & FP_X_INV);
72 fpsetsticky(0);
73
74 /* and now unmask to get a signal */
75 signal_status = 0;
86 fpsetmask(FP_X_INV); 76 fpsetmask(FP_X_INV);
87 x = zero / zero; 77 x = zero / zero;
88 } else if (strcmp(argv[1], "fltovf") == 0) { 78 } else if (strcmp(argv[1], "fltovf") == 0) {
89 /* unmask and then trip overflow */ 79 /* trip overflow */
80 x = huge * huge;
81 assert(fpgetsticky() & FP_X_OFL);
82 fpsetsticky(0);
83
84 /* and now unmask to get a signal */
85 signal_status = 0;
90 fpsetmask(FP_X_OFL); 86 fpsetmask(FP_X_OFL);
91 x = huge * huge; 87 x = huge * huge;
92 } else if (strcmp(argv[1], "fltund") == 0) { 88 } else if (strcmp(argv[1], "fltund") == 0) {
93 /* unmask and then trip underflow */ 89 /* trip underflow */
90 x = tiny * tiny;
91 assert(fpgetsticky() & FP_X_UFL);
92 fpsetsticky(0);
93
94 /* and now unmask to get a signal */
95 signal_status = 0;
94 fpsetmask(FP_X_UFL); 96 fpsetmask(FP_X_UFL);
95 x = tiny * tiny; 97 x = tiny * tiny;
96 } else { 98 } else {