summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vla-stexp-5.c
blob: d6a7f2b34b82a6220f41a9b132792e2773f7235b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* PR29970 */
/* { dg-do run } */
/* { dg-options "-Wunused-variable" } */




int foo2a(void)   // should not ICE
{
        return ({ int n = 20; struct { int x[n];} x; x.x[12] = 1; sizeof(x); });
}


int foo2b(void)   // should not ICE
{
        return sizeof *({ int n = 20; struct { int x[n];} x; x.x[12] = 1; &x; });
}

int main()
{
	if (sizeof(struct { int x[20]; }) != foo2a())
		__builtin_abort();

	if (sizeof(struct { int x[20]; }) != foo2b())
		__builtin_abort();

	return 0;
}