analyzer: fix ICEs treeifying offset_region [PR96646, PR96841]
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 25 Sep 2020 21:15:42 +0000 (17:15 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Sat, 26 Sep 2020 01:33:02 +0000 (21:33 -0400)
commit29f5db8ef81fac4db8e66e5f06fdf1d469e8161c
tree03b825c6057813e07f1546c7efa8ea3acf6fbaea
parentcdd8f031c7edf0fcbf5f20bf5fbd1526a64461d5
analyzer: fix ICEs treeifying offset_region [PR96646, PR96841]

gcc/analyzer/ChangeLog:
PR analyzer/96646
PR analyzer/96841
* region-model.cc (region_model::get_representative_path_var):
When handling offset_region, wrap the MEM_REF's first argument in
an ADDR_EXPR of pointer type, rather than simply using the tree
for the parent region.  Require the MEM_REF's second argument to
be an integer constant.

gcc/testsuite/ChangeLog:
PR analyzer/96646
PR analyzer/96841
* gcc.dg/analyzer/pr96646.c: New test.
* gcc.dg/analyzer/pr96841.c: New test.
gcc/analyzer/region-model.cc
gcc/testsuite/gcc.dg/analyzer/pr96646.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/analyzer/pr96841.c [new file with mode: 0644]