diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-03-10 08:55:00 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-03-10 08:55:00 +0100 |
commit | 72772e6761c5930db346e5cdc2a1537585940502 (patch) | |
tree | 3b1b43eaa52fe7c979ccc7ca4b843381b7b23f9c /gcc/gimple-ssa-warn-alloca.c | |
parent | 5558f089e39350824d7bc3d5467f72e1e90b2fae (diff) | |
download | gcc-72772e6761c5930db346e5cdc2a1537585940502.zip gcc-72772e6761c5930db346e5cdc2a1537585940502.tar.gz gcc-72772e6761c5930db346e5cdc2a1537585940502.tar.bz2 |
re PR tree-optimization/79972 (ICE in tree check: expected ssa_name, have var_decl in get_range_info, at tree-ssanames.c:377 w/ -Walloca -Wvla-larger-than=364854541)
PR tree-optimization/79972
* gimple-ssa-warn-alloca.c (alloca_call_type): Only call
get_range_info on SSA_NAMEs. Formatting fixes.
* gcc.dg/pr79972.c: New test.
From-SVN: r246022
Diffstat (limited to 'gcc/gimple-ssa-warn-alloca.c')
-rw-r--r-- | gcc/gimple-ssa-warn-alloca.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/gimple-ssa-warn-alloca.c b/gcc/gimple-ssa-warn-alloca.c index dd41775..b940efa 100644 --- a/gcc/gimple-ssa-warn-alloca.c +++ b/gcc/gimple-ssa-warn-alloca.c @@ -300,8 +300,9 @@ alloca_call_type (gimple *stmt, bool is_vla, tree *invalid_casted_type) ret = alloca_type_and_limit (ALLOCA_OK); } // Check the range info if available. - else if (value_range_type range_type = get_range_info (len, &min, &max)) + else if (TREE_CODE (len) == SSA_NAME) { + value_range_type range_type = get_range_info (len, &min, &max); if (range_type == VR_RANGE) { if (wi::leu_p (max, max_size)) @@ -328,7 +329,6 @@ alloca_call_type (gimple *stmt, bool is_vla, tree *invalid_casted_type) gimple *def = SSA_NAME_DEF_STMT (len); if (gimple_assign_cast_p (def) && TYPE_UNSIGNED (TREE_TYPE (gimple_assign_rhs1 (def)))) - { len_casted = gimple_assign_rhs1 (def); range_type = get_range_info (len_casted, &min, &max); @@ -344,8 +344,7 @@ alloca_call_type (gimple *stmt, bool is_vla, tree *invalid_casted_type) else if (range_type == VR_ANTI_RANGE) return alloca_type_and_limit (ALLOCA_UNBOUNDED); else if (range_type != VR_VARYING) - return - alloca_type_and_limit (ALLOCA_BOUND_MAYBE_LARGE, max); + return alloca_type_and_limit (ALLOCA_BOUND_MAYBE_LARGE, max); } } else if (range_type == VR_ANTI_RANGE) |