blob: ee60ad67e93f82fbe3aa304a876fee8af5dae4a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* { dg-do run } */
/* { dg-require-effective-target alarm } */
/* { dg-require-effective-target signal } */
/* { dg-options "-O2" } */
#include <stdint.h>
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
int a = 1, b = 0;
uint64_t safe_mod(uint64_t a, uint64_t b)
{
if (b == 0) return a;
else return a % b;
}
int __attribute__((noipa))
f(uint64_t p)
{
int c = 0;
j:
b = safe_mod(
(c = ((a &= (0 < p)) && 1), 1), p);
if (!c)
goto j;
return 0;
}
void do_exit (int i)
{
exit (0);
}
int main()
{
struct sigaction s;
sigemptyset (&s.sa_mask);
s.sa_handler = do_exit;
s.sa_flags = 0;
sigaction (SIGALRM, &s, NULL);
alarm (1);
f(b);
}
|