diff options
author | David Malcolm <dmalcolm@redhat.com> | 2020-03-06 10:13:59 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2020-03-06 16:40:08 -0500 |
commit | 90f7c3007d58c5cb538d00351c038f3f2cfcaf67 (patch) | |
tree | fba68bd8f9bde2e35b792de9f1839fb073d08c8e /gcc/fortran/trans-array.c | |
parent | 41f99ba6c576b84ca0f2de7d66ebc087454e93cf (diff) | |
download | gcc-90f7c3007d58c5cb538d00351c038f3f2cfcaf67.zip gcc-90f7c3007d58c5cb538d00351c038f3f2cfcaf67.tar.gz gcc-90f7c3007d58c5cb538d00351c038f3f2cfcaf67.tar.bz2 |
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.
Diffstat (limited to 'gcc/fortran/trans-array.c')
0 files changed, 0 insertions, 0 deletions