Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/gcc.dg/pr41935.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
rev | line source |
---|---|
111 | 1 /* PR middle-end/41935 */ |
2 /* { dg-do run } */ | |
3 /* { dg-options "-O2" } */ | |
4 | |
5 extern void abort (void); | |
6 struct A { int a; int b[10]; }; | |
7 | |
8 int | |
9 foo (struct A *p) | |
10 { | |
11 return __builtin_offsetof (struct A, b[p->a]); | |
12 } | |
13 | |
14 int | |
15 main () | |
16 { | |
17 struct A a; | |
18 a.a = 7; | |
19 if (foo (&a) != 7 * sizeof (int) + __builtin_offsetof (struct A, b)) | |
20 abort (); | |
21 a.a = 2; | |
22 if (foo (&a) != 2 * sizeof (int) + __builtin_offsetof (struct A, b)) | |
23 abort (); | |
24 return 0; | |
25 } |