Index: c-decl.c =================================================================== --- c-decl.c (revision 133657) +++ c-decl.c (working copy) @@ -1853,6 +1853,7 @@ merge_decls (tree newdecl, tree olddecl, DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl); DECL_STRUCT_FUNCTION (newdecl) = DECL_STRUCT_FUNCTION (olddecl); DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl); + gimple_set_body (newdecl, gimple_body (olddecl)); DECL_ARGUMENTS (newdecl) = DECL_ARGUMENTS (olddecl); /* Set DECL_INLINE on the declaration if we've got a body @@ -1887,6 +1888,10 @@ merge_decls (tree newdecl, tree olddecl, sizeof (struct tree_decl_common) - sizeof (struct tree_common)); switch (TREE_CODE (olddecl)) { + case FUNCTION_DECL: + gimple_set_body (olddecl, gimple_body (newdecl)); + /* fall through */ + case FIELD_DECL: case VAR_DECL: case PARM_DECL: @@ -1894,7 +1899,6 @@ merge_decls (tree newdecl, tree olddecl, case RESULT_DECL: case CONST_DECL: case TYPE_DECL: - case FUNCTION_DECL: memcpy ((char *) olddecl + sizeof (struct tree_decl_common), (char *) newdecl + sizeof (struct tree_decl_common), tree_code_size (TREE_CODE (olddecl)) - sizeof (struct tree_decl_common)); Index: gimplify.c =================================================================== --- gimplify.c (revision 133657) +++ gimplify.c (working copy) @@ -2160,6 +2160,7 @@ gimplify_call_expr (tree *expr_p, gimple int i, nargs; VEC(tree, gc) *args = NULL; gimple call; + bool builtin_va_start_p = FALSE; gcc_assert (TREE_CODE (*expr_p) == CALL_EXPR); @@ -2197,6 +2198,7 @@ gimplify_call_expr (tree *expr_p, gimple if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_VA_START) { + builtin_va_start_p = TRUE; if (call_expr_nargs (*expr_p) < 2) { error ("too few arguments to function %"); @@ -2209,9 +2211,6 @@ gimplify_call_expr (tree *expr_p, gimple *expr_p = build_empty_stmt (); return GS_OK; } - /* Avoid gimplifying the second argument to va_start, which needs - to be the plain PARM_DECL. */ - return gimplify_arg (&CALL_EXPR_ARG (*expr_p, 0), pre_p); } } @@ -2329,10 +2328,15 @@ gimplify_call_expr (tree *expr_p, gimple { enum gimplify_status t; - t = gimplify_arg (&CALL_EXPR_ARG (*expr_p, i), pre_p); + /* Avoid gimplifying the second argument to va_start, which needs + to be the plain PARM_DECL. */ + if ((i != 1) || !builtin_va_start_p) + { + t = gimplify_arg (&CALL_EXPR_ARG (*expr_p, i), pre_p); - if (t == GS_ERROR) - ret = GS_ERROR; + if (t == GS_ERROR) + ret = GS_ERROR; + } VEC_replace (tree, args, i, CALL_EXPR_ARG (*expr_p, i)); }