From patchwork Mon Jun 20 20:09:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 638229 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rYMQt3HgLz9sDk for ; Tue, 21 Jun 2016 06:09:57 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ez/g7edY; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:from:to:subject:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=Vl3z3Urd/9+IotDZ 7KcY8z11aNonteWB92YMlZFg589ee0c+bRTOscpczrfVLKZ5aH1tHSra8YVikght i+6l+FmJYpaYYCksYSNi5tkytJrV9V1L8d/fOCjz3V6cG7YFJd8HjY9KlWwIp2TJ BXi3iNql+sB0fn7zGD46i9b9Elw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :message-id:from:to:subject:mime-version:content-type :content-transfer-encoding; s=default; bh=sL+9xXdG1Lgu5l2blmSBe+ eOFWw=; b=ez/g7edYfk2BRlhFWWSFX9n+o0Mtv10EoNPftTN1NAVHzcpfvgEa49 hIcknW81cyUeyIqdl5xsYYaOQuq94WW+juScsSW/X+TX9XyNHjgxm8F1AUpqaG7E d9QnoR1tDTejRJLcLFxmWwNXrfb0GS4ZSTAg5N3BrncDhbHoA9q+Q= Received: (qmail 81624 invoked by alias); 20 Jun 2016 20:09:50 -0000 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 Received: (qmail 81613 invoked by uid 89); 20 Jun 2016 20:09:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1861, spc, hp X-HELO: bes.se.axis.com Received: from bes.se.axis.com (HELO bes.se.axis.com) (195.60.68.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Jun 2016 20:09:47 +0000 Received: from localhost (localhost [127.0.0.1]) by bes.se.axis.com (Postfix) with ESMTP id 1551D2E1BE for ; Mon, 20 Jun 2016 22:09:44 +0200 (CEST) Received: from bes.se.axis.com ([IPv6:::ffff:127.0.0.1]) by localhost (bes.se.axis.com [::ffff:127.0.0.1]) (amavisd-new, port 10024) with LMTP id L60MFKq1ykd7 for ; Mon, 20 Jun 2016 22:09:43 +0200 (CEST) Received: from boulder.se.axis.com (boulder.se.axis.com [10.0.2.104]) by bes.se.axis.com (Postfix) with ESMTP id 4A9EF2E19B for ; Mon, 20 Jun 2016 22:09:43 +0200 (CEST) Received: from boulder.se.axis.com (localhost [127.0.0.1]) by postfix.imss71 (Postfix) with ESMTP id 2A4911ADA for ; Mon, 20 Jun 2016 22:09:43 +0200 (CEST) Received: from thoth.se.axis.com (thoth.se.axis.com [10.0.2.173]) by boulder.se.axis.com (Postfix) with ESMTP id 1F928188F for ; Mon, 20 Jun 2016 22:09:43 +0200 (CEST) Received: from ignucius.se.axis.com (ignucius.se.axis.com [10.88.21.50]) by thoth.se.axis.com (Postfix) with ESMTP id 1D5CD1050; Mon, 20 Jun 2016 22:09:43 +0200 (CEST) Received: from ignucius.se.axis.com (localhost [127.0.0.1]) by ignucius.se.axis.com (8.12.8p1/8.12.8/Debian-2woody1) with ESMTP id u5KK9gMR025428; Mon, 20 Jun 2016 22:09:42 +0200 Received: (from hp@localhost) by ignucius.se.axis.com (8.12.8p1/8.12.8/Debian-2woody1) id u5KK9g22025424; Mon, 20 Jun 2016 22:09:42 +0200 Date: Mon, 20 Jun 2016 22:09:42 +0200 Message-Id: <201606202009.u5KK9g22025424@ignucius.se.axis.com> From: Hans-Peter Nilsson To: gcc-patches@gcc.gnu.org Subject: Committed, CRIS: fix target/71571, delay-slot nop in PIC MI thunk MIME-Version: 1.0 Committed to trunk. Apparently the -fno-inline is key to keeping the test-case small. Thanks go to the reporter, David B. Robins. gcc: PR target/71571 * config/cris/cris.c (cris_asm_output_mi_thunk): Add missing "ba" delay-slot "nop" for PIC with CRIS v32. Also add missing leading space for PIC with non-v32 and the common non-PIC "jump". gcc/testsuite: PR target/71571 * g++.dg/torture/pr71571.C: New test. brgds, H-P Index: gcc/config/cris/cris.c =================================================================== --- gcc/config/cris/cris.c (revision 235415) +++ gcc/config/cris/cris.c (working copy) @@ -2772,18 +2772,18 @@ cris_asm_output_mi_thunk (FILE *stream, { fprintf (stream, "\tba "); assemble_name (stream, name); - fprintf (stream, "%s\n", CRIS_PLT_PCOFFSET_SUFFIX); + fprintf (stream, "%s\n\tnop\n", CRIS_PLT_PCOFFSET_SUFFIX); } else { - fprintf (stream, "add.d "); + fprintf (stream, "\tadd.d "); assemble_name (stream, name); fprintf (stream, "%s,$pc\n", CRIS_PLT_PCOFFSET_SUFFIX); } } else { - fprintf (stream, "jump "); + fprintf (stream, "\tjump "); assemble_name (stream, XSTR (XEXP (DECL_RTL (funcdecl), 0), 0)); fprintf (stream, "\n"); --- /dev/null Tue Oct 29 15:57:07 2002 +++ pr71571.C Mon Jun 20 21:50:12 2016 @@ -0,0 +1,43 @@ +// { dg-do run } +// { dg-options "-fno-inline" { target { ! fpic } } } +// { dg-options "-fpic -fno-inline" { target fpic } } + +class XBase +{ +public: + virtual void FuncA() = 0; +}; + +class Y +{ +protected: + virtual void FuncB() {} +}; + +class X1 : public Y, public XBase +{ +public: + void FuncA() {} +}; + +class X2 : public XBase +{ +public: + X2(XBase &xb) : m_xb(xb) { } + void FuncA() + { + m_xb.FuncA(); + } + +private: + XBase &m_xb; +}; + + +int main() +{ + X1 x1; + X2 x2(x1); + XBase *pxb = &x2; + pxb->FuncA(); +}