Mercurial > hg > CbC > CbC_gcc
comparison libmudflap/testsuite/libmudflap.c/pass64-frag.c @ 0:a06113de4d67
first commit
author | kent <kent@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Jul 2009 14:47:48 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a06113de4d67 |
---|---|
1 /* PR libmudflap/36397 */ | |
2 /* { dg-do run } */ | |
3 /* { dg-options "-O -fmudflap -fno-strict-aliasing -lmudflap" } */ | |
4 | |
5 struct A | |
6 { | |
7 int a[2]; | |
8 }; | |
9 | |
10 long long int x; | |
11 | |
12 int __attribute__ ((noinline)) | |
13 baz (long long int *x) | |
14 { | |
15 return *x; | |
16 } | |
17 | |
18 int __attribute__ ((noinline)) | |
19 foo (int i) | |
20 { | |
21 if (i > 10) | |
22 return baz (&x); | |
23 return ((struct A *) &x)->a[i]; | |
24 } | |
25 | |
26 int | |
27 main (void) | |
28 { | |
29 if (sizeof (long long) == 2 * sizeof (int) | |
30 && sizeof (long long) == sizeof (struct A)) | |
31 { | |
32 struct A a = { .a[0] = 10, .a[1] = 20 }; | |
33 __builtin_memcpy (&x, &a, sizeof (x)); | |
34 if (foo (0) != 10 || foo (1) != 20) | |
35 __builtin_abort (); | |
36 } | |
37 return 0; | |
38 } |