aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/c99-for-loop.c
blob: 42246c513294fd70cb0698e2b2462756d025abb3 (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
int op(int);

static int good(void)
{
	__context__(1);
	for (int i = 0; i < 10; i++) {
		if (!op(i)) {
			__context__(-1);
			return 0;
		}
	}
	__context__(-1);
	return 1;
}

static int bad(void)
{
	__context__(1);
	for (int i = 0; i < 10; i++) {
		if (!op(i)) {
			__context__(-1);
			return 0;
		}
	}
	return 1;
}
/*
 * check-name: C99 for loop variable declaration
 *
 * check-error-start
c99-for-loop.c:16:12: warning: context imbalance in 'bad' - different lock contexts for basic block
 * check-error-end
 */