repo.or.cz
/
smatch.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
simplify '(x / -1)' to '-x' (but only for signed division)
[smatch.git]
/
validation
/
c99-for-loop.c
blob
42246c513294fd70cb0698e2b2462756d025abb3
1
int
op
(
int
);
2
3
static int
good
(
void
)
4
{
5
__context__
(
1
);
6
for
(
int
i
=
0
;
i
<
10
;
i
++) {
7
if
(!
op
(
i
)) {
8
__context__
(-
1
);
9
return
0
;
10
}
11
}
12
__context__
(-
1
);
13
return
1
;
14
}
15
16
static int
bad
(
void
)
17
{
18
__context__
(
1
);
19
for
(
int
i
=
0
;
i
<
10
;
i
++) {
20
if
(!
op
(
i
)) {
21
__context__
(-
1
);
22
return
0
;
23
}
24
}
25
return
1
;
26
}
27
/*
28
* check-name: C99 for loop variable declaration
29
*
30
* check-error-start
31
c99-for-loop.c:16:12: warning: context imbalance in 'bad' - different lock contexts for basic block
32
* check-error-end
33
*/