Skip to content

Commit 2ce481a

Browse files
Add GCC -fanalyzer
1 parent a84885d commit 2ce481a

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ Results from analysis below, also summarized in c\_testing\_slides.pdf.
1818
More GCC flags which we could have added (would have detected some additional bugs): _"-Wshadow -Wundef -Og"_,
1919
additionally, GCC can provide runtime checks with e.g. _"-fsanitize=undefined"_[1] (not sure how this compares to the Valgrind suite).
2020

21-
I can also add that Cppcheck looks somewhat useful and found _one_ bug not discovered by any of the other tools. (Cppcheck is FOSS)
21+
On later releases GCC (>=10) also provides some static analysis functionality with **_"-fanalyzer"_** [2]. On this code base, GCC (12.1.0) -fanalyzer finds only two issues, namely the double frees in _positives.c_. No FPs.
22+
23+
24+
I can also add that **Cppcheck** looks somewhat useful and found _one_ bug not discovered by any of the other tools. (Cppcheck is FOSS)
2225
Cppcheck was not evaluated below, so I provide a very brief summary here,
2326

2427
```
@@ -42,7 +45,7 @@ Cppcheck 1.82
4245
Example (if included cmake file doesn't work): cppcheck . --enable=all --inconclusive
4346
```
4447

45-
SonarCloud (SonarQube) is another tool not evaluated here, which detected some interesting stuff when tested on another code base.
48+
SonarCloud (**SonarQube**) is another tool not evaluated here, which detected some interesting stuff when tested on another code base (similar to CodeQL few hits, but also very few FP -> that's usable).
4649
(It is proprietary but free to use for open-source software, https://sonarcloud.io/)
4750

4851
There seems to be a never ending list of static analysis tools (especially if we include proprietary and/or expensive products),
@@ -52,7 +55,8 @@ duplicates and FPs is concerning. Only choosing one, the tool of choice would be
5255

5356

5457
[1] - https://blogs.oracle.com/linux/post/improving-application-security-with-undefinedbehaviorsanitizer-ubsan-and-gcc,
55-
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
58+
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html \
59+
[2] - https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-fanalyzer, https://developers.redhat.com/articles/2022/04/12/state-static-analysis-gcc-12-compiler
5660

5761

5862
## Software Used

0 commit comments

Comments
 (0)