PR bootstrap/86621 - 'alloca' bound is unknown in tree-vect-slp.c:1437:16
authorMartin Sebor <msebor@redhat.com>
Sun, 22 Jul 2018 21:09:32 +0000 (21:09 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Sun, 22 Jul 2018 21:09:32 +0000 (15:09 -0600)
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
gcc/gimple-ssa-warn-alloca.c

index 7be6b8d6c1ddb6a13854147964d5d78e1562c502..19fa73a2404b7e206ffd1d5032500cfb635ad10f 100644 (file)
@@ -1,3 +1,10 @@
+2018-07-22  Martin Sebor  <msebor@redhat.com>
+
+       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  <gerald@pfeifer.com>
 
        * doc/gcov.texi (Invoking Gcov): Editorial changes.
index cc66c466217bb5ca1eb6cbd8589731d1de3e707b..0331f66844a32986f3531c3575193e7782b1164c 100644 (file)
@@ -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.