* gcc.c-torture/execute/20101011-1.c: Skip on SH.
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20101011-1.c
blob776a159f54cc5511f1409565205cce1b317ce86d
1 /* With -fnon-call-exceptions 0 / 0 should not be eliminated. The .x
2 file sets the option. */
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 #else
16 # define DO_TEST 1
17 #endif
19 #if DO_TEST
21 #include <signal.h>
23 void
24 sigfpe (int signum __attribute__ ((unused)))
26 exit (0);
29 #endif
31 /* When optimizing, the compiler is smart enough to constant fold the
32 static unset variables i and j to produce 0 / 0, but it can't
33 eliminate the assignment to the global k. */
34 static int i;
35 static int j;
36 int k;
38 int
39 main ()
41 #if DO_TEST
42 signal (SIGFPE, sigfpe);
43 k = i / j;
44 abort ();
45 #else
46 exit (0);
47 #endif