re PR tree-optimization/84224 (ICE in execute, at gimple-ssa-warn-alloca.c:448)
authorAldy Hernandez <aldyh@redhat.com>
Thu, 8 Feb 2018 11:16:25 +0000 (11:16 +0000)
committerAldy Hernandez <aldyh@gcc.gnu.org>
Thu, 8 Feb 2018 11:16:25 +0000 (11:16 +0000)
PR tree-optimization/84224
* gimple-ssa-warn-alloca.c (pass_walloca::execute): Remove assert.
* calls.c (gimple_alloca_call_p): Only return TRUE when we have
non-zero arguments.

From-SVN: r257480

gcc/ChangeLog
gcc/calls.c
gcc/gimple-ssa-warn-alloca.c
gcc/testsuite/gcc.dg/Walloca-16.c [new file with mode: 0644]

index e51ba4f9310b8d7af73dbcc844f3c2763f9909f2..84bf970575bd78a7610a70d509a9b832245c8d4b 100644 (file)
@@ -1,3 +1,10 @@
+2018-02-08  Aldy Hernandez  <aldyh@redhat.com>
+
+       PR tree-optimization/84224
+       * gimple-ssa-warn-alloca.c (pass_walloca::execute): Remove assert.
+       * calls.c (gimple_alloca_call_p): Only return TRUE when we have
+       non-zero arguments.
+
 2018-02-07  Iain Sandoe  <iain@codesourcery.com>
 
        * config/rs6000/altivec.md (*restore_world): Remove LR use.
index 54fea1586312e06d49e9ea2b858e92e831f76780..19c95b8455b4cf41052cf3e83a2ff38f7f7535f9 100644 (file)
@@ -730,7 +730,7 @@ gimple_alloca_call_p (const gimple *stmt)
     switch (DECL_FUNCTION_CODE (fndecl))
       {
       CASE_BUILT_IN_ALLOCA:
-        return true;
+       return gimple_call_num_args (stmt) > 0;
       default:
        break;
       }
index 941810a997ed0c2c2863e13d2dfe139b61537fb5..327c806ae11b877e18c0d45456b4f538a3492bc9 100644 (file)
@@ -445,7 +445,6 @@ pass_walloca::execute (function *fun)
 
          if (!gimple_alloca_call_p (stmt))
            continue;
-         gcc_assert (gimple_call_num_args (stmt) >= 1);
 
          const bool is_vla
            = gimple_call_alloca_for_var_p (as_a <gcall *> (stmt));
diff --git a/gcc/testsuite/gcc.dg/Walloca-16.c b/gcc/testsuite/gcc.dg/Walloca-16.c
new file mode 100644 (file)
index 0000000..3ee96a9
--- /dev/null
@@ -0,0 +1,6 @@
+/* PR tree-optimization/84224 */
+/* { dg-do compile } */
+/* { dg-options "-O0 -Walloca" } */
+
+void *alloca ();
+__typeof__(alloca ()) a () { return alloca (); }