GCC 10 Introduces A Static Analyzer - Static Analysis On C Code With "-fanalyzer" Option
Within GCC's newly minted Git repository is a big last minute feature for the GCC 10 release: a long-awaited static analyzer.
While LLVM's Clang has long offered a static analyzer option, GCC 10 is the first release having a static analysis pass for helping developers spot potential issues in the code. For GCC 10 the static analysis pass is focused on C code and operates off the GIMPLE SSA representation. The static analysis pass will emit warnings over double frees and other malloc/free issues. Presumably for GCC 11 we'll see the language support added and other checks that can be done as static code analysis.
Activating the pass can be done with -fanalyzer but in doing so will lead to significantly longer (potentially double) compile times.
The GCC static analysis framework was originally proposed back in November and developed by Red Hat's David Malcom.
More details on the new GCC static analyzer via this new documentation added when landing the analyzer just minutes ago.
While LLVM's Clang has long offered a static analyzer option, GCC 10 is the first release having a static analysis pass for helping developers spot potential issues in the code. For GCC 10 the static analysis pass is focused on C code and operates off the GIMPLE SSA representation. The static analysis pass will emit warnings over double frees and other malloc/free issues. Presumably for GCC 11 we'll see the language support added and other checks that can be done as static code analysis.
Activating the pass can be done with -fanalyzer but in doing so will lead to significantly longer (potentially double) compile times.
The GCC static analysis framework was originally proposed back in November and developed by Red Hat's David Malcom.
More details on the new GCC static analyzer via this new documentation added when landing the analyzer just minutes ago.
38 Comments