This commit is contained in:
Geoffrey White 2018-11-08 18:10:44 +00:00
Родитель a6b7f2d1f6
Коммит 136ca72297
3 изменённых файлов: 80 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,4 @@
| test.cpp:13:4:13:12 | continue; | This 'continue' never re-runs the loop - the $@ is always false. | test.cpp:16:11:16:15 | 0 | loop condition |
| test.cpp:39:4:39:12 | continue; | This 'continue' never re-runs the loop - the $@ is always false. | test.cpp:36:9:36:13 | 0 | loop condition |
| test.cpp:47:4:47:12 | continue; | This 'continue' never re-runs the loop - the $@ is always false. | test.cpp:44:14:44:18 | 0 | loop condition |
| test.cpp:59:5:59:13 | continue; | This 'continue' never re-runs the loop - the $@ is always false. | test.cpp:62:12:62:16 | 0 | loop condition |

Просмотреть файл

@ -0,0 +1 @@
Likely Bugs/ContinueInFalseLoop.ql

Просмотреть файл

@ -0,0 +1,75 @@
bool cond();
void test1()
{
int i;
// --- do loops ---
do
{
if (cond())
continue; // BAD
if (cond())
break;
} while (false);
do
{
if (cond())
continue;
if (cond())
break;
} while (true);
do
{
if (cond())
continue;
if (cond())
break;
} while (cond());
// --- while, for loops ---
while (false)
{
if (cond())
continue; // GOOD [never reached, if the condition changed so it was then the result would no longer apply] [FALSE POSITIVE]
if (cond())
break;
}
for (i = 0; false; i++)
{
if (cond())
continue; // GOOD [never reached, if the condition changed so it was then the result would no longer apply] [FALSE POSITIVE]
if (cond())
break;
}
// --- nested loops ---
do
{
do
{
if (cond())
continue; // BAD
if (cond())
break;
} while (false);
} while (true);
do
{
do
{
if (cond())
continue; // GOOD
if (cond())
break;
} while (true);
} while (false);
}