Run all checkers
Is there a way to run all the checkers listed, instead of having to specify each one? Or a command to run all non-experimental checkers?
Thanks!
Hi @lwli11! According to infer --help:
--enable-issue-type +issue_type
Show reports coming from this type of issue. By default, all issue
types are enabled except the ones listed in --disable-issue-type.
Note that enabling issue types does not make the corresponding
checker run; see individual checker options to turn them on or off.
See also infer-report(1).
Let us know if you have concrete examples where it does not work as expected.
Hi @davidpichardie,
First, the documentation on issues to check for is very helpful and makes infer one of the better documented analysis tools. I appreciate knowing what bugs infer targets.
Maybe I'm misunderstanding how to enable all checkers? For example, buffer overruns are enabled by default, but analyzing the following code:
int main(){
return 1;
}
int arr(){
int a[3];
a[5] = 42;
return 0;
}
infer run -- g++ array.cpp
Capturing in make/cc mode...
Found 1 source file to analyze in infer-out
1/1 [################################################################################] 100% 40.195ms
No issues found
infer run --bufferoverrun -- g++ array.cpp
Capturing in make/cc mode...
Found 1 source file to analyze ininfer-out
1/1 [################################################################################] 100% 41.804ms
array.cpp:6: error: Buffer Overrun L1
Offset: 5 Size: 3.
4. int arr(){
5. int a[3];
6. a[5] = 42;
^
7. return 0;
8. }
Found 1 issue
Issue Type(ISSUED_TYPE_ID): #
Buffer Overrun L1(BUFFER_OVERRUN_L1): 1
Is there a way to run all the default checkers without specifying '--bufferoverrun', etc?
Thanks!
I believe --default-checkers does what you want.
So first, the issue may be that I'm on issue v1.1.0 since the binary for v1.2.0 isn't available: https://github.com/facebook/infer/releases/download/v1.2.0/infer-linux64-v1.2.0.tar.xz
With --default-checkers, I'm still not seeing buffer overruns being checked:
$ infer run --default-checkers -- g++ array.cpp
Capturing in make/cc mode...
Found 1 source file to analyze in /home.local/savve/cn-exercises/tester/infer-out
1/1 [############################################################] 100% 38.94ms
No issues found
--default-checkers is equivalent to a command line that doesn't disable any checkers.
To double check what checkers are enabled by default, look at the top of the log file for a line looking like
[3676281][environment] Active checkers: self-in-block (C/C++/ObjC), parameter-not-null-checked (C/C++/ObjC), static-constructor-stall-checker (C/C++/ObjC), starvation (C/C++/ObjC, Java), pulse (C/C++/ObjC, C#/.Net, Erlang, Hack, Java, Python, Rust, Swift), liveness (C/C++/ObjC), inefficient-keyset-iterator (Java), fragment-retains-view (Java)
On master, buffer overrun is disabled by default.
Thanks, I see. It seems odd to not enable the bufferoverrun checker but enable the buffer overrun issue to be checked by default.
Well, the enabling of checkers and of issues is a two-level process. An enabled-by-default issue on a disabled-by-default checker simply means that when you enable the checker you will get that issue enabled as part of a standard set of issues without having to manually enable each one.
Why don't add --enable-all?