summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vla-stexp-2.c
blob: 9f1512567f0fc27708705ea4ac18a5df93073c03 (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
31
32
33
34
/* PR101838 */
/* { dg-do run } */
/* { dg-options "-Wpedantic -O0" } */
/* { dg-require-effective-target alloca } */


int bar0(
	int (*a)[*],
	int (*b)[sizeof(*a)]
);


int bar(
	struct f { 		/* { dg-warning "will not be visible outside of this definition" } */
		int a[*]; } v,	/* { dg-warning "variably modified type" } */
	int (*b)[sizeof(struct f)]	// should not warn about zero size
);

int foo(void)
{
	int n = 0;
	return sizeof(typeof(*({ n = 10; struct foo { 	/* { dg-warning "braced-groups" } */
					int x[n]; 	/* { dg-warning "variably modified type" } */
	} x; &x; })));
}


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

	return 0;
}