From: Jason Merrill <jason@redhat.com>
To: Richard Biener <rguenther@suse.de>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] debug/111080 - avoid outputting debug info for unused restrict qualified type
Date: Wed, 23 Aug 2023 15:40:27 -0400 [thread overview]
Message-ID: <ea6157df-9d05-1932-3263-f64557f4ad91@redhat.com> (raw)
In-Reply-To: <58808.123082105113100253@us-mta-49.us.mimecast.lan>
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" } } */
next parent reply other threads:[~2023-08-23 19:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <58808.123082105113100253@us-mta-49.us.mimecast.lan>
2023-08-23 19:40 ` Jason Merrill [this message]
2023-08-21 9:11 Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ea6157df-9d05-1932-3263-f64557f4ad91@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).