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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20101011-1.c] - Blame information for rev 688

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
/* With -fnon-call-exceptions 0 / 0 should not be eliminated.  The .x
2
   file sets the option.  */
3
 
4
#ifdef SIGNAL_SUPPRESS
5
# define DO_TEST 0
6
#elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) || defined (__POWERPC__) || defined (__ppc)
7
  /* On PPC division by zero does not trap.  */
8
# define DO_TEST 0
9
#elif defined (__SPU__)
10
  /* On SPU division by zero does not trap.  */
11
# define DO_TEST 0
12
#elif defined (__sh__)
13
  /* On SH division by zero does not trap.  */
14
# define DO_TEST 0
15
#elif defined (__TMS320C6X__)
16
  /* On TI C6X division by zero does not trap.  */
17
# define DO_TEST 0
18
#elif defined (__arm__)
19
 /* We cannot rely on division by zero generating a trap. */
20
# define DO_TEST 0
21
#elif defined (__mips__) && !defined(__linux__)
22
  /* MIPS divisions do trap by default, but libgloss targets do not
23
     intercept the trap and raise a SIGFPE.  The same is probably
24
     true of other bare-metal environments, so restrict the test to
25
     systems that use the Linux kernel.  */
26
# define DO_TEST 0
27
#elif defined (__mips16) && defined(__linux__)
28
  /* Not all Linux kernels deal correctly the breakpoints generated by
29
     MIPS16 divisions by zero.  They show up as a SIGTRAP instead.  */
30
# define DO_TEST 0
31
#elif defined (__epiphany__)
32
  /* Epiphany does not have hardware division, and the software implementation
33
     has truly undefined behaviour for division by 0.  */
34
# define DO_TEST 0
35
#else
36
# define DO_TEST 1
37
#endif
38
 
39
#if DO_TEST
40
 
41
#include <signal.h>
42
 
43
void
44
sigfpe (int signum __attribute__ ((unused)))
45
{
46
  exit (0);
47
}
48
 
49
#endif
50
 
51
/* When optimizing, the compiler is smart enough to constant fold the
52
   static unset variables i and j to produce 0 / 0, but it can't
53
   eliminate the assignment to the global k.  */
54
static int i;
55
static int j;
56
int k;
57
 
58
int
59
main ()
60
{
61
#if DO_TEST
62
  signal (SIGFPE, sigfpe);
63
  k = i / j;
64
  abort ();
65
#else
66
  exit (0);
67
#endif
68
}

powered by: WebSVN 2.1.0

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