From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 58B73385735A for ; Wed, 23 Aug 2023 19:40:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 58B73385735A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692819631; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8K2I9CwsKjSuk2fUHJCkBAwnADh40+jkP/k7E/fDbrU=; b=V8l27gF55K5RSDM/fZnd9n77AFutBYG4YW1QcrIQvUE12e87lONMFjv+GksaXcpT7dEOFv XUAbvJi/X1Xj8vvl+yXlYV57kbzYvMBK1eYEak4L4BhpuF+moVdBaDoT9Bx/Fp16SJF+eo r1ppuA/brpoX26D922w3QTwQVtnvTBc= Received: from mail-vs1-f71.google.com (mail-vs1-f71.google.com [209.85.217.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-156-rmuJpntVO5G5ZapmU5wo6g-1; Wed, 23 Aug 2023 15:40:29 -0400 X-MC-Unique: rmuJpntVO5G5ZapmU5wo6g-1 Received: by mail-vs1-f71.google.com with SMTP id ada2fe7eead31-44e894b0e06so261081137.3 for ; Wed, 23 Aug 2023 12:40:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692819629; x=1693424429; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8K2I9CwsKjSuk2fUHJCkBAwnADh40+jkP/k7E/fDbrU=; b=feaMYynbHblra2FXd9Mn90ns7Exp4qW96EWt3DWQeAfy4Kizfpt+yhMbWioj6tx8LB y2ezeMYOtLqCqxQuPdUBZ/V7x/EA+YxyzekFlNjQfpK+l2Xki20EAixZk/4xQ6JGpds5 IGQzEzaVhI0ppgkA6vrSHpcRlzoEBOpLQ3WCCGg41tANrUMUuS7Gtt0E01F3TT/wI0Ip maQWpK9ozIQ00cVaJgZp+j3sKKNmJYHZX+dxhYL4Hss/6QErX7PKFo3f+b/SPQ7TPmCo HWODzRWy7+wbqFv5cGO+2S1CsEkivvjzJqCORRdsCL8qNRvGdmkUJGixVsFEgx+kPl43 nQnA== X-Gm-Message-State: AOJu0YzZ/9mFcU3rqwsRQpT4NHExBfRKqkCiPtaZwz/qDkzy8N5ukkEF E033B65GIYHI64rY9VyRKcRkfBiB1Jp5LXftVmK9AjQ0vgNYhxxAXf+5w45Og/GBSnR7NaX+QHz DmK9DNLII7kEgoMcnjA== X-Received: by 2002:a67:bd08:0:b0:44e:8ef9:336d with SMTP id y8-20020a67bd08000000b0044e8ef9336dmr1411089vsq.1.1692819629309; Wed, 23 Aug 2023 12:40:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdu1K2xkPeaCCf4EQoy1yMguUNIjrU9T+Punf+2smYWMb5YmJGd1NtnaBEwH4ZdAa9W8bufQ== X-Received: by 2002:a67:bd08:0:b0:44e:8ef9:336d with SMTP id y8-20020a67bd08000000b0044e8ef9336dmr1411080vsq.1.1692819628930; Wed, 23 Aug 2023 12:40:28 -0700 (PDT) Received: from [192.168.1.108] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id n17-20020a0cdc91000000b0064f45b8c02bsm2271656qvk.49.2023.08.23.12.40.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Aug 2023 12:40:28 -0700 (PDT) Message-ID: Date: Wed, 23 Aug 2023 15:40:27 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH] debug/111080 - avoid outputting debug info for unused restrict qualified type To: Richard Biener , gcc-patches@gcc.gnu.org References: <58808.123082105113100253@us-mta-49.us.mimecast.lan> From: Jason Merrill In-Reply-To: <58808.123082105113100253@us-mta-49.us.mimecast.lan> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,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 List-Id: On 8/21/23 05:11, Richard Biener wrote: > The following applies some maintainance with respect to type qualifiers > and kinds added by later DWARF standards to prune_unused_types_walk. > The particular case in the bug is not handling (thus marking required) > all restrict qualified type DIEs. I've found more DW_TAG_*_type that > are unhandled, looked up the DWARF docs and added them as well based > on common sense. > > Bootstrapped and tested on x86_64-unknown-linux-gnu, OK? OK. > Thanks, > Richard. > > PR debug/111080 > * dwarf2out.cc (prune_unused_types_walk): Handle > DW_TAG_restrict_type, DW_TAG_shared_type, DW_TAG_atomic_type, > DW_TAG_immutable_type, DW_TAG_coarray_type, DW_TAG_unspecified_type > and DW_TAG_dynamic_type as to only output them when referenced. > > * gcc.dg/debug/dwarf2/pr111080.c: New testcase. > --- > gcc/dwarf2out.cc | 7 +++++++ > gcc/testsuite/gcc.dg/debug/dwarf2/pr111080.c | 18 ++++++++++++++++++ > 2 files changed, 25 insertions(+) > create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2/pr111080.c > > diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc > index fa0fe4c41bb..69018bde238 100644 > --- a/gcc/dwarf2out.cc > +++ b/gcc/dwarf2out.cc > @@ -30141,8 +30141,13 @@ prune_unused_types_walk (dw_die_ref die) > case DW_TAG_reference_type: > case DW_TAG_rvalue_reference_type: > case DW_TAG_volatile_type: > + case DW_TAG_restrict_type: > + case DW_TAG_shared_type: > + case DW_TAG_atomic_type: > + case DW_TAG_immutable_type: > case DW_TAG_typedef: > case DW_TAG_array_type: > + case DW_TAG_coarray_type: > case DW_TAG_friend: > case DW_TAG_enumeration_type: > case DW_TAG_subroutine_type: > @@ -30151,6 +30156,8 @@ prune_unused_types_walk (dw_die_ref die) > case DW_TAG_subrange_type: > case DW_TAG_ptr_to_member_type: > case DW_TAG_file_type: > + case DW_TAG_unspecified_type: > + case DW_TAG_dynamic_type: > /* Type nodes are useful only when other DIEs reference them --- don't > mark them. */ > /* FALLTHROUGH */ > diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr111080.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr111080.c > new file mode 100644 > index 00000000000..3949d7e7c64 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr111080.c > @@ -0,0 +1,18 @@ > +/* { dg-do compile } */ > +/* { dg-options "-save-temps -gdwarf-3 -dA" } */ > + > +struct foo { > + int field_number_1; > + int field_number_2; > + int field_number_3; > + int field_number_4; > + int field_number_5; > +}; > + > +typedef int fun_t(struct foo *restrict); > + > +int main() { > + return 0; > +} > + > +/* { dg-final { scan-assembler-not "DW_TAG_structure_type" } } */