From patchwork Tue Jul 12 18:25:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 104416 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 0362FB6F6F for ; Wed, 13 Jul 2011 04:26:07 +1000 (EST) Received: (qmail 10490 invoked by alias); 12 Jul 2011 18:26:06 -0000 Received: (qmail 10478 invoked by uid 22791); 12 Jul 2011 18:26:05 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Jul 2011 18:25:47 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6CIPkLs007833 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 12 Jul 2011 14:25:46 -0400 Received: from anchor.twiddle.net (vpn-225-164.phx2.redhat.com [10.3.225.164]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6CIPkD3024010 for ; Tue, 12 Jul 2011 14:25:46 -0400 Message-ID: <4E1C91A9.90403@redhat.com> Date: Tue, 12 Jul 2011 11:25:45 -0700 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc15 Thunderbird/3.1.10 MIME-Version: 1.0 To: GCC Patches Subject: [i386, darwin] Fix pr/49714 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org It *appears* as if the references we were generating before switching the thunk to rtl weren't valid. Certainly those same references don't pass legitimate_address_p, which is the direct cause of the assertion failure. Fixed by using the same address transformation that ix86_expand_call would have used, rather than doing something by hand. Thanks to Dominiq for testing. Committed. r~ PR target/49714 * config/i386/i386.c (x86_output_mi_thunk): Use machopic_indirect_call_target instead of machopic_indirection_name directly. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 4ca95ab..9f63bf7 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -29409,12 +29409,8 @@ x86_output_mi_thunk (FILE *file, #if TARGET_MACHO else if (TARGET_MACHO) { - rtx sym_ref = XEXP (DECL_RTL (function), 0); - if (TARGET_MACHO_BRANCH_ISLANDS) - sym_ref = (gen_rtx_SYMBOL_REF - (Pmode, - machopic_indirection_name (sym_ref, /*stub_p=*/true))); - fnaddr = gen_rtx_MEM (Pmode, sym_ref); + fnaddr = machopic_indirect_call_target (DECL_RTL (function)); + fnaddr = XEXP (fnaddr, 0); } #endif /* TARGET_MACHO */ else