analyzer: don't assume extern const vars are zero-initialized [PR97568]
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 27 Oct 2020 13:54:25 +0000 (09:54 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Tue, 27 Oct 2020 13:56:25 +0000 (09:56 -0400)
commit16ad9ae85bb5b9acf80f9d1cf2be5a989ef7ba49
tree8e134356ff4d967b99e1cde3c99be3c795151454
parent942086bf73ee2ba6cfd7fdacc552940048437a6e
analyzer: don't assume extern const vars are zero-initialized [PR97568]

gcc/analyzer/ChangeLog:
PR analyzer/97568
* region-model.cc (region_model::get_initial_value_for_global):
Move check that !DECL_EXTERNAL from here to...
* region.cc (decl_region::get_svalue_for_initializer): ...here,
using it to reject zero initialization.

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