Re: trapv question
[gcc.git] / gcc / testsuite / gcc.dg / torture / ftrapv-2.c
1 /* { dg-do run } */
2 /* With -flto this degenerates to constant folding which doesn't work. */
3 /* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */
4 /* { dg-additional-options "-ftrapv" } */
5 /* { dg-require-effective-target trapping } */
6 /* { dg-require-fork "" } */
7
8 #include <stdlib.h>
9 #include <unistd.h>
10 #include <sys/types.h>
11 #include <sys/wait.h>
12
13 /* Verify SImode operations properly trap. PR middle-end/68046 */
14
15 volatile int i = 0x7fffffff;
16
17 int main(void)
18 {
19 pid_t child = fork ();
20 int status = 0;
21 if (child == 0)
22 {
23 i = i + 1;
24 exit (0);
25 }
26 else if (child == -1)
27 return 0;
28 if (wait (&status) == child
29 && status == 0)
30 abort ();
31 return 0;
32 }