From ef856020de21b5e66e0aaec2d2b186817ae2829b Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Sun, 22 Jul 2018 21:09:32 +0000 Subject: [PATCH] PR bootstrap/86621 - 'alloca' bound is unknown in tree-vect-slp.c:1437:16 gcc/ChangeLog: * gcc/gimple-ssa-warn-alloca.c (alloca_call_type_by_arg): Avoid diagnosing calls with unknown arguments unless -Walloca-larger-than is restricted to less than PTRDIFF_MAX bytes. From-SVN: r262923 --- gcc/ChangeLog | 7 +++++++ gcc/gimple-ssa-warn-alloca.c | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7be6b8d6c1d..19fa73a2404 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-07-22 Martin Sebor + + PR bootstrap/86621 + * gcc/gimple-ssa-warn-alloca.c (alloca_call_type_by_arg): Avoid + diagnosing calls with unknown arguments unless -Walloca-larger-than + is restricted to less than PTRDIFF_MAX bytes. + 2018-07-22 Gerald Pfeifer * doc/gcov.texi (Invoking Gcov): Editorial changes. diff --git a/gcc/gimple-ssa-warn-alloca.c b/gcc/gimple-ssa-warn-alloca.c index cc66c466217..0331f66844a 100644 --- a/gcc/gimple-ssa-warn-alloca.c +++ b/gcc/gimple-ssa-warn-alloca.c @@ -214,7 +214,15 @@ alloca_call_type_by_arg (tree arg, tree arg_casted, edge e, } } else - return alloca_type_and_limit (ALLOCA_BOUND_UNKNOWN); + { + /* Analogous to ALLOCA_UNBOUNDED, when MAX_SIZE is greater + than or equal to PTRDIFF_MAX, treat allocations with + an unknown bound as OK. */ + alloca_type unknown_result + = (max_size < maxobjsize.to_uhwi () + ? ALLOCA_BOUND_UNKNOWN : ALLOCA_OK); + return alloca_type_and_limit (unknown_result); + } } // Similarly, but check for a comparison with an unknown LIMIT. -- 2.30.2