OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [setjmp-1.c] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* Test for bogus "variable `x' may be clobbered by longjmp" warnings.
2
   Inspired by cse.c:simplify_relational_operation. */
3
 
4
/* { dg-do compile } */
5
/* { dg-options "-O -Wclobbered -Wextra -Wall" } */
6
 
7
#include <setjmp.h>
8
 
9
extern void set_float_handler (jmp_buf *);
10
 
11
#define EQ 0x01
12
#define LT 0x02
13
#define GT 0x04
14
 
15
int
16
compare_float (double a, double b)  /* { dg-bogus "clobbered" "spurious clobbered warning" } */
17
{
18
  jmp_buf handler;
19
  int result;
20
 
21
  a += 1.0;
22
 
23
  if (setjmp (handler))
24
    {
25
      set_float_handler (0);
26
      return 0;
27
    }
28
 
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;
36
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.