[00/11] Static analysis v2

Message ID 1574284430-8776-1-git-send-email-dmalcolm@redhat.com
Headers show
Series
  • Static analysis v2
Related show

Message

David Malcolm Nov. 20, 2019, 9:13 p.m.
I've rebased my static analysis work (from r276961 to r278495)

This patch kit contains the changes that were needed (patches 1-4),
along with various followups (patches 5-11).

These patches fix the worst of the issues with LTO compatibility;
an example LTO diagnostic is:

https://dmalcolm.fedorapeople.org/gcc/2019-11-18/lto-longjmp-leak-demo.html

which diagnoses a memory leak due to a longjmp rewinding past cleanup
code, where the malloc/free, the setjmp and the longjmp are in
3 separate source files.

Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.

I've pushed these patches to dmalcolm/analyzer-v2 and to
dmalcolm/analyzer on the GCC git mirror.

David Malcolm (11):
  [analyzer] Fix up for params refactoring
  [analyzer] Fixup metadata-handling for "json::number" to
    "json::integer_number"
  [analyzer] Fixup diagnostic_path for "json::number" to
    "json::integer_number"
  [analyzer] Add params to plugin.opt
  [analyzer] Avoid using "convert"
  [analyzer] More LTO test coverage
  [analyzer] Fix missing leak on longjmp past a free
  [analyzer] Show rewind destination for leaks due to longjmp
  [analyzer] Add checker_path::debug
  [analyzer] Fix issues in diagnostic_manager::prune_path
  [analyzer] Updates to internal documentation

 gcc/analyzer/analysis-plan.cc                      |   3 +-
 gcc/analyzer/checker-path.cc                       |  19 ++++
 gcc/analyzer/checker-path.h                        |   2 +-
 gcc/analyzer/diagnostic-manager.cc                 |  41 +++++++-
 gcc/analyzer/diagnostic-manager.h                  |  13 ++-
 gcc/analyzer/engine.cc                             |  70 ++++++++++---
 gcc/analyzer/exploded-graph.h                      |   8 +-
 gcc/analyzer/plugin.opt                            |  16 +++
 gcc/analyzer/program-point.cc                      |   3 +-
 gcc/analyzer/region-model.cc                       |  55 ++++++++++-
 gcc/analyzer/sm-file.cc                            |  34 +++----
 gcc/analyzer/sm-malloc.cc                          |  33 +++----
 gcc/analyzer/sm-pattern-test.cc                    |  17 ----
 gcc/analyzer/sm-sensitive.cc                       |  16 ---
 gcc/analyzer/sm-taint.cc                           |  16 ---
 gcc/analyzer/sm.h                                  |  12 +--
 gcc/diagnostic-format-json.cc                      |   3 +-
 gcc/doc/analyzer.texi                              |  54 +++++++---
 .../gcc.dg/analyzer/analyzer-verbosity-0.c         |  29 ++++++
 .../gcc.dg/analyzer/analyzer-verbosity-1.c         |  30 ++++++
 .../gcc.dg/analyzer/analyzer-verbosity-2.c         |  30 ++++++
 gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto-a.c |  12 +++
 gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto-b.c |  18 ++++
 gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto-c.c |  17 ++++
 gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto.h   |  12 +++
 gcc/testsuite/gcc.dg/analyzer/setjmp-7.c           |   4 +-
 gcc/testsuite/gcc.dg/analyzer/setjmp-7a.c          | 110 +++++++++++++++++++++
 gcc/tree-diagnostic-path.cc                        |   6 +-
 28 files changed, 538 insertions(+), 145 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto-a.c
 create mode 100644 gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto-b.c
 create mode 100644 gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto-c.c
 create mode 100644 gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto.h
 create mode 100644 gcc/testsuite/gcc.dg/analyzer/setjmp-7a.c

-- 
1.8.5.3