facebook / facebook/infer

Issue type not being detected - INVARIANT_CALL

Open
#1,918 0 comments 0 reactions 0 assignees View on GitHub
java
Dominant language
OCaml
Stars
15.7k
Forks
2.1k
Avg merge
19h 36m
Merged PRs (30d)
13

Description

According to Infers documentation Infer should detect (INVARIANT_CALL) but nothing is being detected in this code snippet below. Please are you able to help look into this or provide explanation.

Below is the Java code:

import com.facebook.infer.annotation.Expensive;

class Main {
@Expensive
public int foo(int x, int y) {
return x + y;
}
public void invariant_hoist(int size) {
int x = 10;
int y = 5;
for (int i = 0; i < size; i++) {
foo(x, y);
}
}
public int showBug(int size) {
invariant_hoist(size);
return foo(10, 5);
}
public static void main(String[] args) {
Main main = new Main();
main.showBug(10);
}
}

Command used:

infer run --loop-hoisting -- javac Main.java
infer run --cost -- javac Main.java

Infer versions:

Tested in both Infer version 1.0.0 and 1.2.0

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.