diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-01-08 11:14:29 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-01-08 11:14:29 +0100 |
commit | 33f0852f542c5aa80a0f16cc71a69870a7a754ca (patch) | |
tree | 471897ffa0e6c19e5d2fe4317257bbfcb593fbf8 /gcc/tree-stdarg.c | |
parent | 22518428af7aadf1ec1f5ba957e7ac4c8e9a6acb (diff) | |
download | gcc-33f0852f542c5aa80a0f16cc71a69870a7a754ca.zip gcc-33f0852f542c5aa80a0f16cc71a69870a7a754ca.tar.gz gcc-33f0852f542c5aa80a0f16cc71a69870a7a754ca.tar.bz2 |
re PR tree-optimization/69162 (ICE in create_tmp_var, at gimple-expr.c:468)
PR tree-optimization/69162
* gimplify.c (gimplify_va_arg_expr): Encode original type of
valist argument in another argument.
(gimplify_modify_expr): Adjust for the above change. Cleanup.
* tree-stdarg.c (expand_ifn_va_arg_1): Use new 3rd argument
to determine the va_list type, build a MEM_REF instead of
build_fold_indirect_ref.
* gcc.dg/pr69162.c: New test.
From-SVN: r232156
Diffstat (limited to 'gcc/tree-stdarg.c')
-rw-r--r-- | gcc/tree-stdarg.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c index 9fb16e8..13b92f0 100644 --- a/gcc/tree-stdarg.c +++ b/gcc/tree-stdarg.c @@ -1018,7 +1018,7 @@ expand_ifn_va_arg_1 (function *fun) for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i)) { gimple *stmt = gsi_stmt (i); - tree ap, expr, lhs, type; + tree ap, aptype, expr, lhs, type; gimple_seq pre = NULL, post = NULL; if (!gimple_call_ifn_va_arg_p (stmt)) @@ -1028,9 +1028,12 @@ expand_ifn_va_arg_1 (function *fun) type = TREE_TYPE (TREE_TYPE (gimple_call_arg (stmt, 1))); ap = gimple_call_arg (stmt, 0); + aptype = TREE_TYPE (gimple_call_arg (stmt, 2)); + gcc_assert (POINTER_TYPE_P (aptype)); /* Balanced out the &ap, usually added by build_va_arg. */ - ap = build_fold_indirect_ref (ap); + ap = build2 (MEM_REF, TREE_TYPE (aptype), ap, + build_int_cst (aptype, 0)); push_gimplify_context (false); saved_location = input_location; @@ -1053,7 +1056,7 @@ expand_ifn_va_arg_1 (function *fun) if (chkp_function_instrumented_p (fun->decl)) chkp_fixup_inlined_call (lhs, expr); - if (nargs == 3) + if (nargs == 4) { /* We've transported the size of with WITH_SIZE_EXPR here as the last argument of the internal fn call. Now reinstate |