827.cppcheck_s
SPEC CPU®2026 Benchmark Description

Benchmark Name

827.cppcheck_s

Benchmark Program General Category

Static analysis of C/C++ code

Benchmark Authors

Cppcheck has many contributors; the up-to-date list can be found at github.com/danmar/cppcheck/graphs/contributors.

827.cppcheck_s was submitted to the SPEC CPU v8 Benchmark Search Program by Daniel Marjamäki <daniel [dot] marjamaki[at]gmail [dot] com>, github.com/danmar.

Benchmark Description

Cppcheck is an analysis tool for C/C++ code. It provides unique code analysis to detect bugs and focuses on detecting undefined behaviour and dangerous coding constructs. The goal is to detect only real errors in the code, and generate as few false positives (wrongly reported warnings) as possible. Cppcheck is designed to analyze C/C++ code even if it has non-standard syntax, as is common in embedded projects.

Cppcheck supports a wide variety of static checks that may not be covered by the compiler itself. These checks are static analysis checks that can be performed at a source code level. The program is directed towards static analysis checks that are rigorous, rather than heuristic in nature.

Two executables are built: "test_runner" and "cppcheck". The first is a unit test binary which makes sure that all static checks are being performed, and are not optimized out by an aggressive compiler. Passing the unit test ensures that the same checks are always running during the normal operation and equal work is completed across systems and platforms. The second binary is the normal static analysis program that is benchmarked.

Input Description

The "test" input size is special in that it invokes the "test_runner" binary as well as the "cppcheck" binary. No other input size will run the "test_runner" unit test framework. The "train" and "ref" input sets only run "cppcheck" and they pass it C/C++ source codes to analyze. These are the inputs used for static checking:

Additional workloads can be crafted by supplying different source code files as input, and adjusting which checkers to enable.

Output Description

The output consists of semantic errors found in each of the input files, cited with line numbers. These must match exactly to the reference to allow the benchmark to verify correctly.

In the refspeed version, the processing is done in parallel, which can lead to the raw output printed in a different order based on when threads complete. To alleviate this for verification, the output is sorted alphabetically before checking against the expected output (which is already alphabetically sorted).

Programming Language

C, C++

Threading Model

The SPECrate version is single-threaded. The SPECspeed version uses C++ threads to spawn a checker for each file, up to the number of threads specified in the configuration; it has a builtin job manager / task spawner.

Known Portability Issues

Cppcheck reports the location of static errors using filename and line numbers. The filenames and line numbers are identified in src/lib/sourcelocation.h using either std::source_location, std::experimental::source_location, or __builtin_FILE and __builtin_LINE. Although these options are not in the C++17 standard, compilers commonly support at least one of them, because they need a method for their own error reporting. Source file lib/sourcelocation.h attempts to automatically pick one of the methods.

GNU/Linux systems implement C++ std::thread using POSIX Threads. Although some systems automatically include the needed support, this is not universal. Surprises have been seen when changing OS versions, or libraries, or compilers; or when FDO is added; or when combining C and C++ modules. Typically, it is safest to add -pthread to all compile and link lines for all SPEC CPU benchmarks that use std::thread. Please see the $SPEC/config directory for Example config files that demonstrate how to conveniently do so.

Sources and Licensing

Cppcheck can be downloaded from github.com/danmar/cppcheck. SPEC CPU started with version 2.14.2 at commit hash 55adeb4 on August 19, 2024.

827.cppcheck_s benchmark source code is distributed under the GNU General Public License v3.0. The licenses for the source files are:

The input data for Cppcheck uses a variety of applications which are licensed separately from the Cppcheck sources, as detailed below:

References

Copyright © 2026 Standard Performance Evaluation Corporation (SPEC®)