Debian Codegraph @

gcc/testsuite/c-c++-common/torture/pr117912-2.c

raw
1 /* { dg-do run } */
2
3 struct S { int a; int b[0]; int c[24]; int d; };
4 volatile int *p;
5
6 void __attribute__((noipa))
7 bar (int *q)
8 {
9 p = q;
10 }
11
12 __SIZE_TYPE__ __attribute__((noipa))
13 foo (struct S *p)
14 {
15 bar (&p->b[0]);
16 bar (&p->c[0]);
17 return __builtin_object_size (&p->c[0], 1);
18 }
19
20 int
21 main()
22 {
23 struct S s;
24 __SIZE_TYPE__ x = foo (&s);
25 if (x < sizeof (int) * 24)
26 __builtin_abort ();
27 return 0;
28 }