https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98755
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:e1782d8ad10dc6b556e118fd25fdaff04ce54dde commit r11-7162-ge1782d8ad10dc6b556e118fd25fdaff04ce54dde Author: Jakub Jelinek <ja...@redhat.com> Date: Wed Feb 10 07:54:30 2021 +0100 dwarf2out: Don't prune static data members initialized with constants with -gdwarf-5 [PR98755] In DWARF4 and earlier, static data members were represented as DW_TAG_member and the pruning code wouldn't prune those, but in DWARF5 they are represented as DW_TAG_variable with the class parent and the pruning code prunes those by default unless they are referenced from a separate definition without the class parent (out of class definition). C++17 inline vars have the definitions in the class though and even before if the static data member isn't ODR used, it doesn't need to be defined, so we could just never describe those static data members in the debug info. This change stops the pruning of DW_TAG_variable with DW_AT_const_value attribute with a class parent for -gdwarf-5 and later. This fixes -FAIL: g++.dg/debug/dwarf2/constexpr-var-1.C scan-assembler-times DW_AT_const_expr 2 -FAIL: libstdc++-prettyprinters/80276.cc whatis p4 -FAIL: libstdc++-prettyprinters/80276.cc whatis p4 -FAIL: libstdc++-prettyprinters/libfundts.cc print as -FAIL: libstdc++-prettyprinters/libfundts.cc print as -FAIL: libstdc++-prettyprinters/libfundts.cc print os -FAIL: libstdc++-prettyprinters/libfundts.cc print os 2021-02-10 Jakub Jelinek <ja...@redhat.com> PR debug/98755 * dwarf2out.c (prune_unused_types_walk): Mark DW_TAG_variable DIEs at class scope for DWARF5+.