Debian Codegraph @

gcc/testsuite/gcc.dg/vla-stexp-5.c

raw
1 /* PR29970 */
2 /* { dg-do run } */
3 /* { dg-options "-Wunused-variable" } */
4
5
6
7
8 int foo2a(void) // should not ICE
9 {
10 return ({ int n = 20; struct { int x[n];} x; x.x[12] = 1; sizeof(x); });
11 }
12
13
14 int foo2b(void) // should not ICE
15 {
16 return sizeof *({ int n = 20; struct { int x[n];} x; x.x[12] = 1; &x; });
17 }
18
19 int main()
20 {
21 if (sizeof(struct { int x[20]; }) != foo2a())
22 __builtin_abort();
23
24 if (sizeof(struct { int x[20]; }) != foo2b())
25 __builtin_abort();
26
27 return 0;
28 }
29
30