From patchwork Wed Jul 27 09:38:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 56361 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9017C3857023 for ; Wed, 27 Jul 2022 09:38:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9017C3857023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1658914738; bh=GJV7wmERMaGNjVdqKi3KXmTNxEvX7c2IB0vlojmB8Ns=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=SPgCeBihc79/6Ny0WuuDot5YGF582n2K6Ngw1Ew461ywSGLMHPSzIDumOglKRM7bz KJ08i0EiZVo+ktRHa/xFhhkaBscXSZYEis0FAA38cYTdb02RC5iV9ksq3wgsX0P9lS ZwXFoNF5oXa7uc1dcqnOoF7aOUTw4dGhYylTtujQ= 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 ; 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 , Jan Hubicka Subject: [PATCH] cgraphunit: Don't emit asm thunks for -dx [PR106261] Message-ID: 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-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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 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 --- 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 (); }