Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/pr36339.c

raw
1 extern void abort (void);
2
3 typedef unsigned long my_uintptr_t;
4
5 int check_a(my_uintptr_t tagged_ptr);
6
7 int __attribute__((noinline)) try_a(my_uintptr_t x)
8 {
9 my_uintptr_t heap[2];
10 my_uintptr_t *hp = heap;
11
12 hp[0] = x;
13 hp[1] = 0;
14 return check_a((my_uintptr_t)(void*)((char*)hp + 1));
15 }
16
17 int __attribute__((noinline)) check_a(my_uintptr_t tagged_ptr)
18 {
19 my_uintptr_t *hp = (my_uintptr_t*)(void*)((char*)tagged_ptr - 1);
20
21 if (hp[0] == 42 && hp[1] == 0)
22 return 0;
23 return -1;
24 }
25
26 int main(void)
27 {
28 if (try_a(42) < 0)
29 abort ();
30 return 0;
31 }
32