mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C++: accept loops with arbitrary labels or cases
This commit is contained in:
@@ -50,3 +50,34 @@ int test5(int x, int y) {
|
||||
return x;
|
||||
}
|
||||
|
||||
void test6(int x, int cond) {
|
||||
if (cond) {
|
||||
x++;
|
||||
} else goto end; // GOOD
|
||||
x++;
|
||||
end:
|
||||
}
|
||||
|
||||
void test7(int x, int cond) {
|
||||
if (cond)
|
||||
{
|
||||
goto target;
|
||||
}
|
||||
goto somewhere_else; // GOOD
|
||||
while (x < 10) // not dead code
|
||||
{
|
||||
target:
|
||||
x++;
|
||||
}
|
||||
somewhere_else:
|
||||
switch (1)
|
||||
{
|
||||
goto end;
|
||||
while (x < 10) // not dead code
|
||||
{
|
||||
case 1:
|
||||
x++;
|
||||
} break;
|
||||
}
|
||||
end:
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user