aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2020-09-07 17:43:02 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2020-09-08 10:50:12 -0400
commitaf656c401e97f9de2a8478f18278e8efb2a6cf23 (patch)
treeb1a98686e304911580f9732d9724c5ca1bc0cef6 /gcc
parent47997a32e63b77ec88a7131a5d540f108c698661 (diff)
downloadgcc-af656c401e97f9de2a8478f18278e8efb2a6cf23.zip
gcc-af656c401e97f9de2a8478f18278e8efb2a6cf23.tar.gz
gcc-af656c401e97f9de2a8478f18278e8efb2a6cf23.tar.bz2
analyzer: fix ICE on RANGE_EXPR with CONSTRUCTOR value [PR96950]
gcc/analyzer/ChangeLog: PR analyzer/96950 * store.cc (binding_map::apply_ctor_to_region): Handle RANGE_EXPR where min_index == max_index. (binding_map::apply_ctor_val_to_range): Replace assertion that we don't have a CONSTRUCTOR value with error-handling.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/analyzer/store.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/analyzer/store.cc b/gcc/analyzer/store.cc
index 7f15aa9..94bcbec 100644
--- a/gcc/analyzer/store.cc
+++ b/gcc/analyzer/store.cc
@@ -425,9 +425,18 @@ binding_map::apply_ctor_to_region (const region *parent_reg, tree ctor,
{
tree min_index = TREE_OPERAND (index, 0);
tree max_index = TREE_OPERAND (index, 1);
- if (!apply_ctor_val_to_range (parent_reg, mgr,
- min_index, max_index, val))
- return false;
+ if (min_index == max_index)
+ {
+ if (!apply_ctor_pair_to_child_region (parent_reg, mgr,
+ min_index, val))
+ return false;
+ }
+ else
+ {
+ if (!apply_ctor_val_to_range (parent_reg, mgr,
+ min_index, max_index, val))
+ return false;
+ }
continue;
}
if (!apply_ctor_pair_to_child_region (parent_reg, mgr, index, val))
@@ -472,7 +481,8 @@ binding_map::apply_ctor_val_to_range (const region *parent_reg,
gcc_assert (range_key->concrete_p ());
/* Get the value. */
- gcc_assert (TREE_CODE (val) != CONSTRUCTOR);
+ if (TREE_CODE (val) == CONSTRUCTOR)
+ return false;
const svalue *sval = get_svalue_for_ctor_val (val, mgr);
/* Bind the value to the range. */