From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3519 invoked by alias); 18 Mar 2008 15:38:07 -0000 Received: (qmail 3298 invoked by uid 48); 18 Mar 2008 15:37:23 -0000 Date: Tue, 18 Mar 2008 15:38:00 -0000 Message-ID: <20080318153723.3297.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/35616] [4.1/4.2/4.3/4.4 Regression] Incorrect code while O2 compling In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "matz at gcc dot gnu dot org" 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 X-SW-Source: 2008-03/txt/msg01505.txt.bz2 ------- Comment #15 from matz at gcc dot gnu dot org 2008-03-18 15:37 ------- We can either force expanding the call address before the arguments (if it overlaps with them) or simply validate the thing after the fact. Validating seems a bit easier (and is in line with what is done already for the expansion of overlapping arguments). Proof of concept patch: Index: calls.c =================================================================== --- calls.c (revision 133304) +++ calls.c (working copy) @@ -2756,8 +2756,15 @@ expand_call (tree exp, rtx target, int i use_reg (&call_fusage, struct_value); } - funexp = prepare_call_address (funexp, static_chain_value, + { + rtx before_arg = get_last_insn (); + + funexp = prepare_call_address (funexp, static_chain_value, &call_fusage, reg_parm_seen, pass == 0); + if (pass == 0 + && check_sibcall_argument_overlap (before_arg, 0, 0)) + sibcall_failure = 1; + } load_register_parameters (args, num_actuals, &call_fusage, flags, pass == 0, &sibcall_failure); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35616