8 #include <libc-internal.h>
13 if (FE_ALL_EXCEPT
== 0)
15 printf("Skipping test; no support for FP exceptions.\n");
21 except_mask
|= FE_DIVBYZERO
;
24 except_mask
|= FE_INVALID
;
27 except_mask
|= FE_OVERFLOW
;
30 except_mask
|= FE_UNDERFLOW
;
32 int status
= feenableexcept (except_mask
);
34 except_mask
= fegetexcept ();
35 if (except_mask
== -1)
37 printf("\nBefore getcontext(): fegetexcept returned: %d\n",
43 status
= getcontext(&ctx
);
46 printf("\ngetcontext failed, errno: %d.\n", errno
);
50 printf ("\nDone with getcontext()!\n");
53 /* On nios2 and tilepro, GCC 5 warns that except_mask may be used
54 uninitialized. Because it is always initialized and nothing in
55 this test ever calls setcontext (a setcontext call could result
56 in local variables being clobbered on the second return from
57 getcontext), in fact an uninitialized use is not possible. */
58 DIAG_PUSH_NEEDS_COMMENT
;
59 DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
60 int mask
= fegetexcept ();
61 if (mask
!= except_mask
)
63 printf("\nAfter getcontext(): fegetexcept returned: %d, expected: %d.\n",
68 printf("\nAt end fegetexcept() returned %d, expected: %d.\n",
70 DIAG_POP_NEEDS_COMMENT
;
75 #define TEST_FUNCTION do_test ()
76 #include "../test-skeleton.c"