diff options
author | Marek Polacek <polacek@redhat.com> | 2017-03-21 16:21:14 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2017-03-21 16:21:14 +0000 |
commit | edc1747f1f60974e9005c3ef992b818007666655 (patch) | |
tree | 40a58dfe5efaeb129ba95eb66ef150ff568215e7 /gcc/gimple-ssa-warn-alloca.c | |
parent | 85106b8757d46f80a5993fc75948a82ce16c1f74 (diff) | |
download | gcc-edc1747f1f60974e9005c3ef992b818007666655.zip gcc-edc1747f1f60974e9005c3ef992b818007666655.tar.gz gcc-edc1747f1f60974e9005c3ef992b818007666655.tar.bz2 |
re PR tree-optimization/80109 (ICE in get_range_info, at tree-ssanames.c:375)
PR tree-optimization/80109
* gimple-ssa-warn-alloca.c (alloca_call_type): Only call get_range_info
on INTEGRAL_TYPE_P.
* gcc.dg/Walloca-14.c: New test.
Co-Authored-By: Martin Sebor <msebor@redhat.com>
From-SVN: r246325
Diffstat (limited to 'gcc/gimple-ssa-warn-alloca.c')
-rw-r--r-- | gcc/gimple-ssa-warn-alloca.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/gcc/gimple-ssa-warn-alloca.c b/gcc/gimple-ssa-warn-alloca.c index b940efa..ec95cc6 100644 --- a/gcc/gimple-ssa-warn-alloca.c +++ b/gcc/gimple-ssa-warn-alloca.c @@ -327,11 +327,20 @@ alloca_call_type (gimple *stmt, bool is_vla, tree *invalid_casted_type) // away with better range information. But it gets // most of the cases. gimple *def = SSA_NAME_DEF_STMT (len); - if (gimple_assign_cast_p (def) - && TYPE_UNSIGNED (TREE_TYPE (gimple_assign_rhs1 (def)))) + if (gimple_assign_cast_p (def)) { - len_casted = gimple_assign_rhs1 (def); - range_type = get_range_info (len_casted, &min, &max); + tree rhs1 = gimple_assign_rhs1 (def); + tree rhs1type = TREE_TYPE (rhs1); + + // Bail if the argument type is not valid. + if (!INTEGRAL_TYPE_P (rhs1type)) + return alloca_type_and_limit (ALLOCA_OK); + + if (TYPE_UNSIGNED (rhs1type)) + { + len_casted = rhs1; + range_type = get_range_info (len_casted, &min, &max); + } } // An unknown range or a range of the entire domain is // really no range at all. |