Message ID | 20231030125736.E95CD138EF@imap2.suse-dmz.suse.de |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2188907vqb; Mon, 30 Oct 2023 05:58:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHerJMXdsyVA0IisEgKf2pjz4fiySQpcd0PD5YT8lQssm6vcR6p1drkB6Lzfds3B5ETeZ5W X-Received: by 2002:a05:6808:210d:b0:3ac:aae1:6d64 with SMTP id r13-20020a056808210d00b003acaae16d64mr11754716oiw.2.1698670682162; Mon, 30 Oct 2023 05:58:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698670682; cv=pass; d=google.com; s=arc-20160816; b=aCRn49/pYObOlh5S9dcLqgSB6961A6dkCpKb/CWdyVU+Gt+tNNs8kwQaT7r6waFDHW bOzLhdk14E1STy76I/MPKr3pUKVQnLYtW+CqxQuw00I6bp9JKfXA8ooC91E7KM5YcQBR 0haF5nQc88yp+w+Xyk86KzJTSPL24aHcFiunxkqnL3F1mH+RQY2tLOkoVI7oGOrV+foK hSLB2XDSkKFni6F1PKHbLN4zFAYAuBrzsxb5aqpb+rozGzX/YmnoYMsQN1qo6KNiVBSS 9nTprF8DdWDnlphDaumeclXhK+i1sDFKgJzVPcNvkYjrBwVsGqaKwzCNsri9xoCmggTF s3DA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:message-id:mime-version:subject :cc:to:from:date:dkim-signature:dkim-signature:arc-filter :dmarc-filter:delivered-to; bh=bWIrCB+TZ1rYm8jf24dj1Xx0PvIhTKYJ8IvwqNQe+ow=; fh=5l65ChxB+LJ3KHDAgu/vAsBrjCUh1SK1i8vti5+om/4=; b=QvGDW7UHTRGW71VDpX9tax5K9DHsmMtbVv9dsfmuY0sidlC/AIvfrcLwxhICR/pBb1 sKEJOL8GFW5qMJw29Yhvn+h/4pGhYbhSp/1obuam8bBvMaN9JtEmUaOfVkg1X4UMU52w nXpWyZ5eBxE4OzrMQHAoHPeuPpmDc/saxAiWSd3QO55WGP7HWaZ6Eh9TaPe9uRyeuRnT Lo4Xjm2+q/vHnFgjZYR2aElLwGN08BZy2oGauhrgwIx8EpqNMFshbAecfZ2G8R1jzar9 27SvBQHj7wvQEnF5470rTVzGWTJDPg5Bnl/9WtYFgE9fL2eWhTYv5EsgwxYv6uWGEa87 Ykqg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=MXS5alFj; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=x7cyHbRn; arc=pass (i=1); 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=suse.de Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id j16-20020a0cc350000000b0065b087a5385si5483596qvi.431.2023.10.30.05.58.02 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 05:58:02 -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=@suse.de header.s=susede2_rsa header.b=MXS5alFj; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=x7cyHbRn; arc=pass (i=1); 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=suse.de Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E38FA3857705 for <ouuuleilei@gmail.com>; Mon, 30 Oct 2023 12:58:01 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 041A93858D28 for <gcc-patches@gcc.gnu.org>; Mon, 30 Oct 2023 12:57:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 041A93858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 041A93858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.220.29 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698670659; cv=none; b=UkO/W8xMjPhTHv1PjZ0e8G+71xKJZr1s9+wUfSIo8bZ+QxpX4BnU9o6z8RFmNiT3DXUX1DXiqPID7EUKqgveHSeW5AjMwAG80J92juQJxE/16igqWf7simB4B5uJ0R8l06poqvEHmVhMLzMUBrh3BfrOwMOiEjtTfkWCHWP6Y14= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698670659; c=relaxed/simple; bh=eYPTLLs3WpepMHU8P5/ZSQXkw0c0znxCj9N7q+Qz1/4=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:MIME-Version: Message-Id; b=u8mydlk1cCeZg6v0MLBWFPLkgmz934Qj6SHUlZsPDGTvGKNv/Q3GC74SezybYNQI+ikljHs7H147gD7QYFJudptjCxHzoyleW+jihGor9LZN4gSPNOEPCwEcGeCuBH+2HNb0BVn9IB7AGqbkFxV5TUM0uqv5Sv/oWOA4uWawJv0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1403C1FF05; Mon, 30 Oct 2023 12:57:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698670657; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=bWIrCB+TZ1rYm8jf24dj1Xx0PvIhTKYJ8IvwqNQe+ow=; b=MXS5alFjQvF1pv63S1bCk7bQExvXRkabD+6Rq8qZ47R4ceCZoepCjFVeGyG1Fs8hX+6nFp 4R594mdxN5+s1Z9nUkM+3I9Z6nnUxHVG1FThssgkMDRq1rxeyze9sIpo5Ztp65rmazTz+S 1/iuzXWysSb34qHo1pTHB1s1mRXVP1U= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698670657; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type; bh=bWIrCB+TZ1rYm8jf24dj1Xx0PvIhTKYJ8IvwqNQe+ow=; b=x7cyHbRnG8mwwXqFY+WFKu4CdJJuhHi6XkkcYWBLdtObYrxkQJ72h4xeMYR9rHb45F2/+R dBMIdUuH8BQvyIAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E95CD138EF; Mon, 30 Oct 2023 12:57:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id S0y8N0CoP2VxBgAAMHmgww (envelope-from <rguenther@suse.de>); Mon, 30 Oct 2023 12:57:36 +0000 Date: Mon, 30 Oct 2023 13:57:36 +0100 (CET) From: Richard Biener <rguenther@suse.de> To: gcc-patches@gcc.gnu.org cc: jason@redhat.com, Jakub Jelinek <jakub@redhat.com> Subject: [PATCH] Assert we don't create recursive DW_AT_abstract_origin MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Message-Id: <20231030125736.E95CD138EF@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, 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.30 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> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781185309585040288 X-GMAIL-MSGID: 1781185309585040288 |
Series |
Assert we don't create recursive DW_AT_abstract_origin
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Richard Biener
Oct. 30, 2023, 12:57 p.m. UTC
We have a support case that shows GCC 7 sometimes creates DW_TAG_label refering to itself via a DW_AT_abstract_origin when using LTO. This for example triggers the sanity check added below during LTO bootstrap. Making this check cover more than just DW_AT_abstract_origin breaks bootstrap on trunk for /* GNU extension: Record what type our vtable lives in. */ if (TYPE_VFIELD (type)) { tree vtype = DECL_FCONTEXT (TYPE_VFIELD (type)); gen_type_die (vtype, context_die); add_AT_die_ref (type_die, DW_AT_containing_type, lookup_type_die (vtype)); so the check is for now restricted to DW_AT_abstract_origin. Bootstrapped on x86_64-unknown-linux-gnu, OK? My workaround for the GCC 7 problem is
Comments
On 10/30/23 08:57, Richard Biener wrote: > We have a support case that shows GCC 7 sometimes creates > DW_TAG_label refering to itself via a DW_AT_abstract_origin > when using LTO. This for example triggers the sanity check > added below during LTO bootstrap. > > Making this check cover more than just DW_AT_abstract_origin > breaks bootstrap on trunk for > > /* GNU extension: Record what type our vtable lives in. */ > if (TYPE_VFIELD (type)) > { > tree vtype = DECL_FCONTEXT (TYPE_VFIELD (type)); > > gen_type_die (vtype, context_die); > add_AT_die_ref (type_die, DW_AT_containing_type, > lookup_type_die (vtype)); > > so the check is for now restricted to DW_AT_abstract_origin. > > Bootstrapped on x86_64-unknown-linux-gnu, OK? Let's also check for DW_AT_specification, since that's the other one get_AT follows. OK with that change. > My workaround for the GCC 7 problem is > > diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c > index 5590845d2a4..07185a1a0d3 100644 > --- a/gcc/dwarf2out.c > +++ b/gcc/dwarf2out.c > @@ -23030,7 +23031,7 @@ gen_label_die (tree decl, dw_die_ref context_die) > lbl_die = new_die (DW_TAG_label, context_die, decl); > equate_decl_number_to_die (decl, lbl_die); > > - if (origin != NULL) > + if (origin != NULL && origin != decl) > add_abstract_origin_attribute (lbl_die, origin); > else > add_name_and_src_coords_attributes (lbl_die, decl); > > that's not needed on trunk because there we dont' end up > with LABEL_DECLs with self-DECL_ABSTRACT_ORIGIN (and not DECL_ABSTRACT). > > Thanks, > Richard. > > * dwarf2out.cc (add_AT_die_ref): Assert we do not add > a self-ref DW_AT_abstract_origin. > --- > gcc/dwarf2out.cc | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc > index 1e0cec66c5e..0070a9e8412 100644 > --- a/gcc/dwarf2out.cc > +++ b/gcc/dwarf2out.cc > @@ -4908,6 +4908,7 @@ add_AT_die_ref (dw_die_ref die, enum dwarf_attribute attr_kind, dw_die_ref targ_ > { > dw_attr_node attr; > gcc_checking_assert (targ_die != NULL); > + gcc_assert (targ_die != die || attr_kind != DW_AT_abstract_origin); > > /* With LTO we can end up trying to reference something we didn't create > a DIE for. Avoid crashing later on a NULL referenced DIE. */
On Thu, 16 Nov 2023, Jason Merrill wrote: > On 10/30/23 08:57, Richard Biener wrote: > > We have a support case that shows GCC 7 sometimes creates > > DW_TAG_label refering to itself via a DW_AT_abstract_origin > > when using LTO. This for example triggers the sanity check > > added below during LTO bootstrap. > > > > Making this check cover more than just DW_AT_abstract_origin > > breaks bootstrap on trunk for > > > > /* GNU extension: Record what type our vtable lives in. */ > > if (TYPE_VFIELD (type)) > > { > > tree vtype = DECL_FCONTEXT (TYPE_VFIELD (type)); > > > > gen_type_die (vtype, context_die); > > add_AT_die_ref (type_die, DW_AT_containing_type, > > lookup_type_die (vtype)); > > > > so the check is for now restricted to DW_AT_abstract_origin. > > > > Bootstrapped on x86_64-unknown-linux-gnu, OK? > > Let's also check for DW_AT_specification, since that's the other one get_AT > follows. OK with that change. The following is what I applied. Richard. From 2c070d92beea9e46947693c623b44551dc18e513 Mon Sep 17 00:00:00 2001 From: Richard Biener <rguenther@suse.de> Date: Mon, 30 Oct 2023 13:17:11 +0100 Subject: [PATCH] Assert we don't create recursive DW_AT_{abstract_origin,specification} To: gcc-patches@gcc.gnu.org We have a support case that shows GCC 7 sometimes creates DW_TAG_label refering to itself via a DW_AT_abstract_origin when using LTO. This for example triggers the sanity check added below during LTO bootstrap. Making this check cover more than just DW_AT_abstract_origin breaks bootstrap on trunk for /* GNU extension: Record what type our vtable lives in. */ if (TYPE_VFIELD (type)) { tree vtype = DECL_FCONTEXT (TYPE_VFIELD (type)); gen_type_die (vtype, context_die); add_AT_die_ref (type_die, DW_AT_containing_type, lookup_type_die (vtype)); so the check is for now restricted to DW_AT_abstract_origin and DW_AT_specification both of which we follow within get_AT. * dwarf2out.cc (add_AT_die_ref): Assert we do not add a self-ref DW_AT_abstract_origin or DW_AT_specification. --- gcc/dwarf2out.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 9850d094707..d187be9b786 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -4908,6 +4908,9 @@ add_AT_die_ref (dw_die_ref die, enum dwarf_attribute attr_kind, dw_die_ref targ_ { dw_attr_node attr; gcc_checking_assert (targ_die != NULL); + gcc_assert (targ_die != die + || (attr_kind != DW_AT_abstract_origin + && attr_kind != DW_AT_specification)); /* With LTO we can end up trying to reference something we didn't create a DIE for. Avoid crashing later on a NULL referenced DIE. */
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 5590845d2a4..07185a1a0d3 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -23030,7 +23031,7 @@ gen_label_die (tree decl, dw_die_ref context_die) lbl_die = new_die (DW_TAG_label, context_die, decl); equate_decl_number_to_die (decl, lbl_die); - if (origin != NULL) + if (origin != NULL && origin != decl) add_abstract_origin_attribute (lbl_die, origin); else add_name_and_src_coords_attributes (lbl_die, decl); that's not needed on trunk because there we dont' end up with LABEL_DECLs with self-DECL_ABSTRACT_ORIGIN (and not DECL_ABSTRACT). Thanks, Richard. * dwarf2out.cc (add_AT_die_ref): Assert we do not add a self-ref DW_AT_abstract_origin. --- gcc/dwarf2out.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 1e0cec66c5e..0070a9e8412 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -4908,6 +4908,7 @@ add_AT_die_ref (dw_die_ref die, enum dwarf_attribute attr_kind, dw_die_ref targ_ { dw_attr_node attr; gcc_checking_assert (targ_die != NULL); + gcc_assert (targ_die != die || attr_kind != DW_AT_abstract_origin); /* With LTO we can end up trying to reference something we didn't create a DIE for. Avoid crashing later on a NULL referenced DIE. */