summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-11-15 23:30:15 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2010-11-15 23:30:15 +0100
commit7a4f257ddd7903fd2553d92a4e6539d8fa6a67e5 (patch)
tree52009d637941b6371d2d19e2fbdc4a0d8ec836e9 /gcc/tree-ssa-forwprop.c
parentecbfe87a7b42248d14cd05f1dfa77a29854fc1a8 (diff)
downloadgcc-7a4f257ddd7903fd2553d92a4e6539d8fa6a67e5.tar.gz
re PR tree-optimization/46461 (ICE: invalid argument to gimple call at -O with __builtin_memset())
PR tree-optimization/46461 * tree-ssa-forwprop.c (simplify_builtin_call): Ensure ptr1 is a gimple val. * gcc.c-torture/compile/pr46461.c: New test. From-SVN: r166776
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 7e7e2b152ee..f68395a57c9 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -1594,6 +1594,9 @@ simplify_builtin_call (gimple_stmt_iterator *gsi_p, tree callee2)
memcpy call. */
gimple_stmt_iterator gsi = gsi_for_stmt (stmt1);
+ if (!is_gimple_val (ptr1))
+ ptr1 = force_gimple_operand_gsi (gsi_p, ptr1, true, NULL_TREE,
+ true, GSI_SAME_STMT);
gimple_call_set_fndecl (stmt2, built_in_decls [BUILT_IN_MEMCPY]);
gimple_call_set_arg (stmt2, 0, ptr1);
gimple_call_set_arg (stmt2, 1, new_str_cst);