facebook / facebook/infer

False Negative: INFINITE_EXECUTION_TIME missing for empty-increment for loop

Open
#2,005 1 comment 1 reaction 0 assignees View on GitHub
false-negative java
Dominant language
OCaml
Stars
15.7k
Forks
2.1k
Avg merge
19h 36m
Merged PRs (30d)
13

Description

**Description**
Infer fails to report an **INFINITE_EXECUTION_TIME** error when a for loop has an empty increment expression and the loop variable is never modified, resulting in an obvious infinite loop.
```java
public class TestInfiniteLoop {
static void bugMissed() {
int j;
for (j = 0; j <= 1;) {} // <- should report INFINITE_EXECUTION_TIME (FN)
}
}
```
**Expected behavior**
**INFINITE_EXECUTION_TIME** should be reported for void TestInfiniteLoop.bugMissed(), since the function contains a non-terminating loop whose execution cost is ∞.

**Actual behavior**
The infinite loop is silently ignored.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.