2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / setjmp-1.c
blob85e0fb4261fa06967adb3c66c4d6fc7827f53ada
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 -W -Wall" } */
7 #include <setjmp.h>
9 extern void set_float_handler (jmp_buf *);
11 #define EQ 0x01
12 #define LT 0x02
13 #define GT 0x04
15 int
16 compare_float (double a, double b) /* { dg-bogus "clobbered" "spurious clobbered warning" { xfail *-*-* } } */
18 jmp_buf handler;
19 int result;
21 a += 1.0;
23 if (setjmp (handler))
25 set_float_handler (0);
26 return 0;
29 set_float_handler (&handler);
30 if (a == b) result = EQ;
31 else if (a > b) result = LT;
32 else if (a < b) result = GT;
33 else result = 0;
34 set_float_handler (0);
35 return result;