From: Marek Polacek Date: Tue, 7 Mar 2017 17:30:53 +0000 (+0000) Subject: re PR middle-end/79809 (ICE in alloca_call_type, at gimple-ssa-warn-alloca.c:282) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d8a90142db624db1f1db43de334e98d02a4dcfd2;p=gcc.git re PR middle-end/79809 (ICE in alloca_call_type, at gimple-ssa-warn-alloca.c:282) PR middle-end/79809 * gimple-ssa-warn-alloca.c (pass_walloca::gate): Use HOST_WIDE_INT. (alloca_call_type): Likewise. * g++.dg/Walloca1.C: New test. From-SVN: r245955 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 39ca488eabc..250bd8cf512 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-03-07 Marek Polacek + + PR middle-end/79809 + * gimple-ssa-warn-alloca.c (pass_walloca::gate): Use HOST_WIDE_INT. + (alloca_call_type): Likewise. + 2017-03-07 Martin Liska * gcov.c (process_args): Put comment to correct location. diff --git a/gcc/gimple-ssa-warn-alloca.c b/gcc/gimple-ssa-warn-alloca.c index d553a346bfe..dd41775f712 100644 --- a/gcc/gimple-ssa-warn-alloca.c +++ b/gcc/gimple-ssa-warn-alloca.c @@ -78,7 +78,8 @@ pass_walloca::gate (function *fun ATTRIBUTE_UNUSED) if (first_time_p) return warn_alloca != 0; - return warn_alloca_limit > 0 || warn_vla_limit > 0; + return ((unsigned HOST_WIDE_INT) warn_alloca_limit > 0 + || (unsigned HOST_WIDE_INT) warn_vla_limit > 0); } // Possible problematic uses of alloca. @@ -278,8 +279,8 @@ alloca_call_type (gimple *stmt, bool is_vla, tree *invalid_casted_type) wide_int min, max; struct alloca_type_and_limit ret = alloca_type_and_limit (ALLOCA_UNBOUNDED); - gcc_assert (!is_vla || warn_vla_limit > 0); - gcc_assert (is_vla || warn_alloca_limit > 0); + gcc_assert (!is_vla || (unsigned HOST_WIDE_INT) warn_vla_limit > 0); + gcc_assert (is_vla || (unsigned HOST_WIDE_INT) warn_alloca_limit > 0); // Adjust warn_alloca_max_size for VLAs, by taking the underlying // type into account. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 932e792bd75..ce63eb0dfde 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-07 Marek Polacek + + PR middle-end/79809 + * g++.dg/Walloca1.C: New test. + 2017-03-07 Martin Liska PR middle-end/68270 diff --git a/gcc/testsuite/g++.dg/Walloca1.C b/gcc/testsuite/g++.dg/Walloca1.C new file mode 100644 index 00000000000..23b97e83c91 --- /dev/null +++ b/gcc/testsuite/g++.dg/Walloca1.C @@ -0,0 +1,6 @@ +/* PR middle-end/79809 */ +/* { dg-do compile } */ +/* { dg-options "-Walloca-larger-than=4207115063 -Wvla-larger-than=1233877270 -O2" } */ + +int a; +char *b = static_cast(__builtin_alloca (a)); // { dg-warning "argument to .alloca. may be too large" }