2018-04-09 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / pr78185.c
blob405f7489dae05c937352cf58eeb714114ac94e6d
1 /* { dg-do run { target *-*-linux* *-*-gnu* } } */
2 /* { dg-options "-O" } */
4 #include <unistd.h>
5 #include <signal.h>
6 #include <stdlib.h>
8 static char var1 = 0L;
9 static char *var2 = &var1;
11 void do_exit (int i)
13 exit (0);
16 int main(void)
18 struct sigaction s;
19 sigemptyset (&s.sa_mask);
20 s.sa_handler = do_exit;
21 s.sa_flags = 0;
22 sigaction (SIGALRM, &s, NULL);
23 alarm (1);
24 /* The following loop is infinite, the division by zero should not
25 be hoisted out of it. */
26 for (; (var1 == 0 ? 0 : (100 / var1)) == *var2; );
27 return 0;