c: Allow bool and enum null pointer constants [PR112556]
[official-gcc.git] / gcc / testsuite / gcc.dg / setjmp-1.c
blob600fb7f1ca1bed7372db997848e1803e608ade77
1 /* Test for bogus "variable `x' may be clobbered by longjmp" warnings.
2 Inspired by cse.c:simplify_relational_operation. */
4 /* { dg-do compile } */
5 /* { dg-options "-O -Wclobbered -Wextra -Wall" } */
6 /* { dg-skip-if "" { ! nonlocal_goto } } */
8 #include <setjmp.h>
10 extern void set_float_handler (jmp_buf *);
12 #define EQ 0x01
13 #define LT 0x02
14 #define GT 0x04
16 int
17 compare_float (double a, double b) /* { dg-bogus "clobbered" "spurious clobbered warning" } */
19 jmp_buf handler;
20 int result;
22 a += 1.0;
24 if (setjmp (handler))
26 set_float_handler (0);
27 return 0;
30 set_float_handler (&handler);
31 if (a == b) result = EQ;
32 else if (a > b) result = LT;
33 else if (a < b) result = GT;
34 else result = 0;
35 set_float_handler (0);
36 return result;