Skip to content

Instantly share code, notes, and snippets.

@daparic
Created February 9, 2026 16:41
Show Gist options
  • Select an option

  • Save daparic/cc98fc89944898fc4303b886eca355b9 to your computer and use it in GitHub Desktop.

Select an option

Save daparic/cc98fc89944898fc4303b886eca355b9 to your computer and use it in GitHub Desktop.
Parasoft C/C++test static analysis steps for demo-eclipse

Static Analysis Steps — demo-eclipse

Environment

  • Tool: Parasoft C/C++test 2025.2.0 (Standard)
  • Install path: /opt/parasoft/cpptest_professional-2025.2.0-linux.x86_64
  • Properties file: /home/dx/cpptestcli.properties (local node-locked license)
  • Compiler: gcc_13-64
  • Config: builtin://Recommended Rules

Steps

1. Clean the project

cd /home/dx/src/demo-eclipse
make clean

2. Trace the build with cpptesttrace

/opt/parasoft/cpptest_professional-2025.2.0-linux.x86_64/bin/cpptesttrace make -j8

This intercepts all compiler/linker invocations and generates cpptestscan.bdf in the project directory.

3. Run static analysis with cpptestcli

/opt/parasoft/cpptest_professional-2025.2.0-linux.x86_64/bin/cli/cpptestcli \
  -config "builtin://Recommended Rules" \
  -compiler gcc_13-64 \
  -input cpptestscan.bdf \
  -property /home/dx/cpptestcli.properties \
  -report /tmp/cpptest-report

4. Review results

  • HTML report: /tmp/cpptest-report/report.html
  • XML report: /tmp/cpptest-report/report.xml
  • Metrics: /tmp/cpptest-report/metrics.xml

Results Summary

7 violations found:

# Rule File Line Description
1 BD-PB-ARRAY main.cpp 88 Array out of bounds — accessing numbers[4] on a 3-element array
2 BD-PB-CC main.cpp 25 Dead condition — p == 0 always evaluates to false
3 BD-PB-CC ATM.cpp 13 Dead condition — myCurrentAccount check always true
4 BD-PB-ZERO main.cpp 35 Division by zero — numberOfEmployees may be zero
5 BD-PB-ZERO main.cpp 19 Division by zero — daysWorkedInPassedMonth may be zero
6 OPT-14 ATM.cpp 11 password parameter passed by value instead of const reference
7 OPT-14 Bank.cpp 15 password parameter passed by value instead of const reference

Notes

  • The 2025.x installs are Standard edition (not Professional), so -data (workspace) option is not available.
  • Standard edition uses -input <bdf> instead of -data <workspace> -bdf <bdf>.
  • The 2025.2.0 cpptesttrace generates cpptestscan.bdf (not cpptesttrace.bdf).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment