From bd2c4d6d8fffd5a6dae5217d6076cc4190bab13d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 21 Aug 2023 10:34:30 +0200 Subject: debug/111080 - avoid outputting debug info for unused restrict qualified type 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. 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 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/dwarf2out.cc') diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index fa0fe4c..69018bd 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 */ -- cgit v1.1