diff --git a/gcc/analyzer/region.cc b/gcc/analyzer/region.cc index a8d1ae92deb..b78bf4ec1b7 100644 --- a/gcc/analyzer/region.cc +++ b/gcc/analyzer/region.cc @@ -1152,6 +1152,11 @@ decl_region::get_svalue_for_initializer (region_model_manager *mgr) const if (binding->symbolic_p ()) return NULL; + /* If we don't care about tracking the content of this region, then + it's unused, and the value doesn't matter. */ + if (!tracked_p ()) + return NULL; + binding_cluster c (this); c.zero_fill_region (mgr->get_store_manager (), this); return mgr->get_or_create_compound_svalue (TREE_TYPE (m_decl), diff --git a/gcc/testsuite/gcc.dg/analyzer/untracked-2.c b/gcc/testsuite/gcc.dg/analyzer/untracked-2.c new file mode 100644 index 00000000000..565a9ccd58e --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/untracked-2.c @@ -0,0 +1,7 @@ +typedef unsigned char u8; +extern int foo(const u8 *key, unsigned int keylen); +int test (void) +{ + static const u8 default_salt[64]; + return foo(default_salt, 64); +}