diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2018-02-08 11:16:25 +0000 |
---|---|---|
committer | Aldy Hernandez <aldyh@gcc.gnu.org> | 2018-02-08 11:16:25 +0000 |
commit | eacac712e337690ee21ce37fd06b2fe8b10a58f1 (patch) | |
tree | 3d01b15ec6e89ab66d02404fcd045aced712bbcb | |
parent | 3b263f5af20f4ebb92fad0b8797fe59e3cebf828 (diff) | |
download | gcc-eacac712e337690ee21ce37fd06b2fe8b10a58f1.zip gcc-eacac712e337690ee21ce37fd06b2fe8b10a58f1.tar.gz gcc-eacac712e337690ee21ce37fd06b2fe8b10a58f1.tar.bz2 |
re PR tree-optimization/84224 (ICE in execute, at gimple-ssa-warn-alloca.c:448)
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
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/calls.c | 2 | ||||
-rw-r--r-- | gcc/gimple-ssa-warn-alloca.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/Walloca-16.c | 6 |
4 files changed, 14 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e51ba4f..84bf970 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/calls.c b/gcc/calls.c index 54fea15..19c95b8 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -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; } diff --git a/gcc/gimple-ssa-warn-alloca.c b/gcc/gimple-ssa-warn-alloca.c index 941810a..327c806 100644 --- a/gcc/gimple-ssa-warn-alloca.c +++ b/gcc/gimple-ssa-warn-alloca.c @@ -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 index 0000000..3ee96a9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Walloca-16.c @@ -0,0 +1,6 @@ +/* PR tree-optimization/84224 */ +/* { dg-do compile } */ +/* { dg-options "-O0 -Walloca" } */ + +void *alloca (); +__typeof__(alloca ()) a () { return alloca (); } |