From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120246 invoked by alias); 27 Apr 2015 15:45:24 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 120211 invoked by uid 48); 27 Apr 2015 15:45:20 -0000 From: "vries at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/65887] remove va_arg ap copies Date: Mon, 27 Apr 2015 15:45:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-04/txt/msg02302.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65887 --- Comment #4 from vries at gcc dot gnu.org --- (In reply to Richard Biener from comment #3) > (In reply to vries from comment #2) > Rather than marking the va_list arg addressable in all the cases above > you should probably simply ensure the frontend marks it so from the > point it creates a variable with va_list type. This is because even > > va_list a1, a2; > a1 = a2; > __builtin_va_arg (a1, ...); > > might go wrong when gimplifying a1 = a2. > This seems to do the trick, I'll put it through some more testing: ... diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 9797e17..d6a93d9 10044 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -5910,6 +5910,7 @@ set_compound_literal_name (tree decl) tree build_va_arg (location_t loc, tree expr, tree type) { + mark_addressable (expr); expr = build1 (VA_ARG_EXPR, type, expr); SET_EXPR_LOCATION (expr, loc); return expr; ...