analyzer: handle &STRING_CST in constant pool initializers [PR96642]
authorDavid Malcolm <dmalcolm@redhat.com>
Sat, 15 Aug 2020 19:34:21 +0000 (15:34 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Mon, 17 Aug 2020 18:45:00 +0000 (14:45 -0400)
commit35c5f8fb432c8e68af68ab48c8d3107e7839775e
treeb1da377e692ddf911a2e70a51153f32383ead30d
parent9e026191547225ca02c1eda91f898271fced3bbf
analyzer: handle &STRING_CST in constant pool initializers [PR96642]

In r11-2708-g2867118ddda9b56d991c16022f7d3d634ed08313 I added support to
the analyzer for initialization from var_decls in the global constant
pool.  However, that commit didn't support initialization from
ADDR_EXPR of a STRING_CST leading to an ICE seen in data-model-1.c and
pr94639.c on arm and powerpc64 at least, and as PR analyzer/96642 on
x86_64 at least.

This patch adds support for such initializers, fixing the ICE.

gcc/analyzer/ChangeLog:
PR analyzer/96642
* store.cc (get_svalue_for_ctor_val): New.
(binding_map::apply_ctor_to_region): Call it.

gcc/testsuite/ChangeLog:
PR analyzer/96642
* gcc.dg/analyzer/pr96642.c: New test.
gcc/analyzer/store.cc
gcc/testsuite/gcc.dg/analyzer/pr96642.c [new file with mode: 0644]