Message ID | YuEHj/BMEVuC5OvQ@tucnak |
---|---|
State | New, archived |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6a10:b5d6:b0:2b9:3548:2db5 with SMTP id v22csp284664pxt; Wed, 27 Jul 2022 02:39:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u+P+89hmmT6jilUoy3yKh/TJRWAo8vcpv8y7PJYky3tpocEAoxQ4vf6ictCiZItXFltwhD X-Received: by 2002:a17:907:7d8b:b0:72f:2306:329a with SMTP id oz11-20020a1709077d8b00b0072f2306329amr16463334ejc.369.1658914754050; Wed, 27 Jul 2022 02:39:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658914754; cv=none; d=google.com; s=arc-20160816; b=dDa87VrkYOWp3N/9fSbrLKUL7MWK8VYaTwTbHQCqaxApRbte8Pm6wohvBB8Z1ZPYY0 n5E/VUOciN6WQNN3G9zo7ou0HV8RexB+HKlx6m9HxbQtkVgfWL93VGHJ79QBN6d6QxD/ 9je3YAtRm5Ete2nDjV+OACjS+ccDVW7qnVQaF9TXwlLreuFj4XzGoQxXvlZtA5nMWSC9 BEuB0JuKyX8hFCJV3LRAAFw/38lcpJmmfITEf91FiJZqeVeZ9JJFgZV2XYIixN41fkL2 GRmLPCseD5J3DoGfk/3VEJxesOsOhYqhG78U6eCwUeyXpDig+imsSeyUHHXv0vD+Rgys M3gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=GJV7wmERMaGNjVdqKi3KXmTNxEvX7c2IB0vlojmB8Ns=; b=p7KSB6OVKZ/bI0gSHf17LtDu5d+lJ5Tbin7VFrBVgJJQuUBsOLgKA2Np2yEAMjJvLX zlG6LwOBCMlBZVKt39YXgt9ms17cGBXqE+LrOXfT2x7yGIN9H2duQTE6ByJIwkgwlwY4 ZJRUUnaYb3Cy99o1QQktnpeNu12cgxeyFZSvv8yC3hIrHZc/37TyT54g+3rvl62zi7cC xhxQxTJvCCNj+n78rH4w0C/ge0V+ChyZBzmjMdzSMpFScUREySWBqCqbWt6gTn3x2uQ7 GfHKuqYZVGB6n/3VWXXPgilL5+ocq5U9Omb2GXY4q2gYmz80m8OsPHWX1sB+Zdkoi/4e R2BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=njjIqvxG; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d34-20020a056402402200b0043b981a754csi16654150eda.333.2022.07.27.02.39.13 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jul 2022 02:39:14 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=njjIqvxG; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ABCD83857020 for <ouuuleilei@gmail.com>; Wed, 27 Jul 2022 09:39:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ABCD83857020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1658914752; bh=GJV7wmERMaGNjVdqKi3KXmTNxEvX7c2IB0vlojmB8Ns=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=njjIqvxG5w2+v7PBHay2GwTd0c51VhmTrE0l4jl5iqXIObkvAw03ogsdqB/4MVWzw 1knVeTaAUvfEh0/fJCgaQGa+G9M0p7mZdqsZB3YacKi8OyvgkobSNP8TKhQjqKT/Mv 39N2+U8H/MH+7G6LZpcr32O++F4aR1Q+/4fKIXr0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 641DE3857375 for <gcc-patches@gcc.gnu.org>; Wed, 27 Jul 2022 09:38:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 641DE3857375 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-629-6WSRf1oOMfueWkKk5NxlVg-1; Wed, 27 Jul 2022 05:38:28 -0400 X-MC-Unique: 6WSRf1oOMfueWkKk5NxlVg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3EA743C01DF1; Wed, 27 Jul 2022 09:38:28 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 005182026D64; Wed, 27 Jul 2022 09:38:27 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 26R9cP582208247 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 27 Jul 2022 11:38:25 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 26R9cOm92208246; Wed, 27 Jul 2022 11:38:24 +0200 Date: Wed, 27 Jul 2022 11:38:23 +0200 To: Richard Biener <rguenther@suse.de>, Jan Hubicka <jh@suse.cz> Subject: [PATCH] cgraphunit: Don't emit asm thunks for -dx [PR106261] Message-ID: <YuEHj/BMEVuC5OvQ@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Jakub Jelinek <jakub@redhat.com> Cc: gcc-patches@gcc.gnu.org Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1739498196882193219?= X-GMAIL-MSGID: =?utf-8?q?1739498196882193219?= |
Series |
cgraphunit: Don't emit asm thunks for -dx [PR106261]
|
|
Commit Message
Jakub Jelinek
July 27, 2022, 9:38 a.m. UTC
Hi! When -dx option is used (didn't know we have it and no idea what is it useful for), we just expand functions to RTL and then omit all further RTL passes, so the normal functions aren't actually emitted into assembly, just variables. The following testcase ICEs, because we don't emit the methods, but do emit thunks pointing to that and those thunks have unwind info and rely on at least some real functions to be emitted (which is normally the case, thunks are only emitted for locally defined functions) because otherwise there are no CIEs, only FDEs and dwarf2out is upset about it. The following patch fixes that by not emitting assembly thunks for -dx either. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2022-07-27 Jakub Jelinek <jakub@redhat.com> PR debug/106261 * cgraphunit.cc (cgraph_node::assemble_thunks_and_aliases): Don't output asm thunks for -dx. * g++.dg/debug/pr106261.C: New test. Jakub
Comments
On Wed, 27 Jul 2022, Jakub Jelinek wrote: > Hi! > > When -dx option is used (didn't know we have it and no idea what is it > useful for), we just expand functions to RTL and then omit all further > RTL passes, so the normal functions aren't actually emitted into assembly, > just variables. > The following testcase ICEs, because we don't emit the methods, but do > emit thunks pointing to that and those thunks have unwind info and rely on > at least some real functions to be emitted (which is normally the case, > thunks are only emitted for locally defined functions) because otherwise > there are no CIEs, only FDEs and dwarf2out is upset about it. > > The following patch fixes that by not emitting assembly thunks for -dx > either. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? OK/ > 2022-07-27 Jakub Jelinek <jakub@redhat.com> > > PR debug/106261 > * cgraphunit.cc (cgraph_node::assemble_thunks_and_aliases): Don't > output asm thunks for -dx. > > * g++.dg/debug/pr106261.C: New test. > > --- gcc/cgraphunit.cc.jj 2022-06-27 11:18:02.048066608 +0200 > +++ gcc/cgraphunit.cc 2022-07-26 16:01:38.696956950 +0200 > @@ -1753,7 +1753,7 @@ cgraph_node::assemble_thunks_and_aliases > cgraph_node *thunk = e->caller; > > e = e->next_caller; > - expand_thunk (thunk, true, false); > + expand_thunk (thunk, !rtl_dump_and_exit, false); > thunk->assemble_thunks_and_aliases (); > } > else > --- gcc/testsuite/g++.dg/debug/pr106261.C.jj 2022-07-26 15:59:04.082979550 +0200 > +++ gcc/testsuite/g++.dg/debug/pr106261.C 2022-07-26 15:58:37.301329916 +0200 > @@ -0,0 +1,36 @@ > +// PR debug/106261 > +// { dg-do compile } > +// { dg-options "-dx -fno-dwarf2-cfi-asm" } > + > +struct A > +{ > + virtual void foo (); > + int a; > +}; > +class C : virtual public A > +{ > +}; > +struct B > +{ > + A *b; > + > + B (A *x) : b (x) { b->foo (); } > +}; > +struct E > +{ > + virtual ~E (); > +}; > +class D : public C, E > +{ > +}; > +struct F : D > +{ > + F (int); > + > + static void bar () > + { > + F a (0); > + B b (&a); > + } > +}; > +void baz () { F::bar (); } > > Jakub > >
--- gcc/cgraphunit.cc.jj 2022-06-27 11:18:02.048066608 +0200 +++ gcc/cgraphunit.cc 2022-07-26 16:01:38.696956950 +0200 @@ -1753,7 +1753,7 @@ cgraph_node::assemble_thunks_and_aliases cgraph_node *thunk = e->caller; e = e->next_caller; - expand_thunk (thunk, true, false); + expand_thunk (thunk, !rtl_dump_and_exit, false); thunk->assemble_thunks_and_aliases (); } else --- gcc/testsuite/g++.dg/debug/pr106261.C.jj 2022-07-26 15:59:04.082979550 +0200 +++ gcc/testsuite/g++.dg/debug/pr106261.C 2022-07-26 15:58:37.301329916 +0200 @@ -0,0 +1,36 @@ +// PR debug/106261 +// { dg-do compile } +// { dg-options "-dx -fno-dwarf2-cfi-asm" } + +struct A +{ + virtual void foo (); + int a; +}; +class C : virtual public A +{ +}; +struct B +{ + A *b; + + B (A *x) : b (x) { b->foo (); } +}; +struct E +{ + virtual ~E (); +}; +class D : public C, E +{ +}; +struct F : D +{ + F (int); + + static void bar () + { + F a (0); + B b (&a); + } +}; +void baz () { F::bar (); }