OSDN Git Service

2010-05-02 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / torture / pr36373-10.c
1 /* { dg-do run } */
2
3 #if (__SIZEOF_LONG_LONG__ == __SIZEOF_POINTER__)
4 typedef unsigned long long uintptr_t;
5 #elif (__SIZEOF_LONG__ == __SIZEOF_POINTER__)
6 typedef unsigned long uintptr_t;
7 #elif (__SIZEOF_INT__ == __SIZEOF_POINTER__)
8 typedef unsigned int uintptr_t;
9 #else
10 #error Add target support here
11 #endif
12
13 void __attribute__((noinline))
14 foo(uintptr_t l)
15 {
16   int *p = (int *)l;
17   *p = 1;
18 }
19
20 extern void abort (void);
21 int main()
22 {
23   int b = 0;
24   uintptr_t l = (uintptr_t)&b;
25   foo(l);
26   if (b != 1)
27     abort ();
28   return 0;
29 }