]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/analyzer/ChangeLog
analyzer: improvements to region_model::get_representative_tree
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 6 Mar 2020 15:13:59 +0000 (10:13 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 6 Mar 2020 21:40:08 +0000 (16:40 -0500)
commit90f7c3007d58c5cb538d00351c038f3f2cfcaf67
treefba68bd8f9bde2e35b792de9f1839fb073d08c8e
parent41f99ba6c576b84ca0f2de7d66ebc087454e93cf
analyzer: improvements to region_model::get_representative_tree

This patch extends region_model::get_representative_tree so that dumps
are able to refer to string literals, which I've found useful in
investigating a state-bloat issue.

Doing so uncovered a bug in the handling of views I introduced in
r10-7024-ge516294a1acb28aaaad44cfd583cc6a80354044e where the code was
erroneously using TREE_TYPE on the view region's type, rather than just
using its type, which the patch also fixes.

gcc/analyzer/ChangeLog:
* analyzer.h (class array_region): New forward decl.
* program-state.cc (selftest::test_program_state_dumping_2): New.
(selftest::analyzer_program_state_cc_tests): Call it.
* region-model.cc (array_region::constant_from_key): New.
(region_model::get_representative_tree): Handle region_svalue by
generating an ADDR_EXPR.
(region_model::get_representative_path_var): In view handling,
remove erroneous TREE_TYPE when determining the type of the tree.
Handle array regions and STRING_CST.
(selftest::assert_dump_tree_eq): New.
(ASSERT_DUMP_TREE_EQ): New macro.
(selftest::test_get_representative_tree): New selftest.
(selftest::analyzer_region_model_cc_tests): Call it.
* region-model.h (region::dyn_cast_array_region): New vfunc.
(array_region::dyn_cast_array_region): New vfunc implementation.
(array_region::constant_from_key): New decl.

gcc/testsuite/ChangeLog:
* gcc.dg/analyzer/malloc-4.c: Update expected output of leak to
reflect fix to region_model::get_representative_path_var, adding
the missing "*" from the cast.
gcc/analyzer/ChangeLog
gcc/analyzer/analyzer.h
gcc/analyzer/program-state.cc
gcc/analyzer/region-model.cc
gcc/analyzer/region-model.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/analyzer/malloc-4.c