aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-11-29 09:03:46 +0100
committerRichard Biener <rguenther@suse.de>2022-11-29 10:25:39 +0100
commit9948daa4fd0f0ea0a9d56c2fefe1bca478554d27 (patch)
tree2409e439f992c7daad214f33069e31b625fb020d
parent5894a8179687b7028d093584102d204af422cfd3 (diff)
downloadgcc-9948daa4fd0f0ea0a9d56c2fefe1bca478554d27.zip
gcc-9948daa4fd0f0ea0a9d56c2fefe1bca478554d27.tar.gz
gcc-9948daa4fd0f0ea0a9d56c2fefe1bca478554d27.tar.bz2
tree-optimization/107898 - ICE with -Walloca-larger-than
The following avoids ICEing with a mismatched prototype for alloca and -Walloca-larger-than using irange for checks which doesn't like mismatched types. PR tree-optimization/107898 * gimple-ssa-warn-alloca.cc (alloca_call_type): Check the type of the alloca argument is compatible with size_t before querying ranges.
-rw-r--r--gcc/gimple-ssa-warn-alloca.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/gimple-ssa-warn-alloca.cc b/gcc/gimple-ssa-warn-alloca.cc
index 83a241a..dcc62ca 100644
--- a/gcc/gimple-ssa-warn-alloca.cc
+++ b/gcc/gimple-ssa-warn-alloca.cc
@@ -217,6 +217,7 @@ alloca_call_type (gimple *stmt, bool is_vla)
int_range_max r;
if (warn_limit_specified_p (is_vla)
&& TREE_CODE (len) == SSA_NAME
+ && types_compatible_p (TREE_TYPE (len), size_type_node)
&& get_range_query (cfun)->range_of_expr (r, len, stmt)
&& !r.varying_p ())
{