From: Aldy Hernandez Date: Fri, 2 Dec 2016 12:20:42 +0000 (+0000) Subject: re PR middle-end/78328 (wrong wording for unbounded alloc case in -Walloca-larger... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc9037a6e93f50efae6494a849c09a7ffa4b253f;p=gcc.git re PR middle-end/78328 (wrong wording for unbounded alloc case in -Walloca-larger-than note) PR middle-end/78328 * gimple-ssa-warn-alloca.c (alloca_call_type): Handle VR_ANTI_RANGE. From-SVN: r243174 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 03387cfcac0..afac97374a5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-12-02 Aldy Hernandez + + PR middle-end/78328 + * gimple-ssa-warn-alloca.c (alloca_call_type): Handle + VR_ANTI_RANGE. + 2016-12-02 Andreas Krebbel * config/s390/s390.c (s390_save_gprs_to_fprs): Fix RTL sharing diff --git a/gcc/gimple-ssa-warn-alloca.c b/gcc/gimple-ssa-warn-alloca.c index e75f2fa76fc..ae379f90c0c 100644 --- a/gcc/gimple-ssa-warn-alloca.c +++ b/gcc/gimple-ssa-warn-alloca.c @@ -339,6 +339,8 @@ alloca_call_type (gimple *stmt, bool is_vla, tree *invalid_casted_type) { // Fall through. } + 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); diff --git a/gcc/testsuite/gcc.dg/Walloca-12.c b/gcc/testsuite/gcc.dg/Walloca-12.c new file mode 100644 index 00000000000..5d71cda8e51 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Walloca-12.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-Walloca-larger-than=128 -O2" } */ + +void f (void*); + +void g (unsigned int n) +{ + if (n == 7) + n = 11; + f (__builtin_alloca (n)); /* { dg-warning "unbounded use of 'alloca'" } */ +}