2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr36339.c
blobc4f36ddcaceb32b291e17ff607c6a440f6690f07
1 extern void abort (void);
3 typedef unsigned long my_uintptr_t;
5 int check_a(my_uintptr_t tagged_ptr);
7 int __attribute__((noinline)) try_a(my_uintptr_t x)
9 my_uintptr_t heap[2];
10 my_uintptr_t *hp = heap;
12 hp[0] = x;
13 hp[1] = 0;
14 return check_a((my_uintptr_t)(void*)((char*)hp + 1));
17 int __attribute__((noinline)) check_a(my_uintptr_t tagged_ptr)
19 my_uintptr_t *hp = (my_uintptr_t*)(void*)((char*)tagged_ptr - 1);
21 if (hp[0] == 42 && hp[1] == 0)
22 return 0;
23 return -1;
26 int main(void)
28 if (try_a(42) < 0)
29 abort ();
30 return 0;