GCC 10 Introduces A Static Analyzer - Static Analysis On C Code With "-fanalyzer" Option

Written by Michael Larabel in GNU on 14 January 2020 at 03:52 PM EST. 38 Comments
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.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week