aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/vla-sizeof.c
blob: 43079992c07ed26c54eadf81e1944b060bf2dbc2 (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
35
36
37
unsigned long vla_sizeof0(int size)
{
	int a[size];
	return sizeof(a);
}

unsigned long vla_sizeof1(int size)
{
	struct s {
		int a[size];
	};
	return sizeof(struct s);
}

unsigned long vla_sizeof2(int size)
{
	struct s {
		int a[size];
	} *p;
	return sizeof(*p);
}

void* vla_inc(int size, void *base)
{
	struct s {
		int a[size];
	} *p = base;

	++p;
	return p;
}

/*
 * check-name: vla-sizeof.c
 *
 * check-known-to-fail
 */