From 89d9bf44969f8c244b0039d01e6546d9f43e8410 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Wed, 14 Nov 2018 19:30:47 +0000 Subject: [PATCH] [debug/88006] -fdebug-types-section gives undefined ref https://gcc.gnu.org/ml/gcc-patches/2018-11/msg01280.html PR debug/88006 PR debug/87462 * dwarf2out.c (dwarf2out_finish): Apply resolve_addr to comdat type list. * g++.dg/debug/dwarf2/pr87462.C: New. * g++.dg/debug/dwarf2/pr88006.C: New. From-SVN: r266158 --- gcc/ChangeLog | 7 ++++ gcc/dwarf2out.c | 2 ++ gcc/testsuite/ChangeLog | 7 ++++ gcc/testsuite/g++.dg/debug/dwarf2/pr87462.C | 20 +++++++++++ gcc/testsuite/g++.dg/debug/dwarf2/pr88006.C | 39 +++++++++++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/pr87462.C create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/pr88006.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 568cdeef42b..0bb3b84439b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-11-14 Nathan Sidwell + + PR debug/88006 + PR debug/87462 + * dwarf2out.c (dwarf2out_finish): Apply resolve_addr to comdat + type list. + 2018-11-14 David Malcolm * Makefile.in (CFLAGS-optinfo-emit-json.o): Add $(ZLIBINC). diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 8b478aa265f..aba88434981 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -31182,6 +31182,8 @@ dwarf2out_finish (const char *filename) FOR_EACH_CHILD (die, c, gcc_assert (! c->die_mark)); } #endif + for (ctnode = comdat_type_list; ctnode != NULL; ctnode = ctnode->next) + resolve_addr (ctnode->root_die); resolve_addr (comp_unit_die ()); move_marked_base_types (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 524db268617..9d52f14fc00 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2018-11-14 Nathan Sidwell + + PR debug/88006 + PR debug/87462 + * g++.dg/debug/dwarf2/pr87462.C: New. + * g++.dg/debug/dwarf2/pr88006.C: New. + 2018-11-14 Paolo Carlini * g++.dg/cpp0x/nsdmi-union6.C: Test locations too. diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr87462.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr87462.C new file mode 100644 index 00000000000..bfbaad0c413 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr87462.C @@ -0,0 +1,20 @@ +// { dg-additional-options "-dA -std=gnu++17 -gdwarf-4 -O1 -fdebug-types-section" } +// reject .pseudo label, but "label" is ok. +// { dg-final { scan-assembler-not "\[^L\"\]_ZN5Test18testFuncEv" } } +// undefined ref to _ZN5Test18testFuncEv + +class Test1 { +public: + static int testFunc() { return 1; } +}; + +template +class TestWrapper { +public: + static T func() __attribute((noinline)) { return (*funcImpl)(); } +}; + +int main() { + return TestWrapper::func(); +} diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr88006.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr88006.C new file mode 100644 index 00000000000..86584e17763 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr88006.C @@ -0,0 +1,39 @@ +// { dg-additional-options "-dA -std=gnu++17 -gdwarf-4 -O1 -fdebug-types-section" } +// reject .pseudo label, but "label" is ok. +// { dg-final { scan-assembler-not "\[^\"\]_ZN3Foo4mfunEv" } } +// undefined ref to _ZN3Foo4mfunEv + +struct Foo { + void mfun () {} +}; + +struct A { static constexpr bool Value = false; }; + +template struct B { typedef int Type; }; + +class Arg +{ + template struct Local : A {}; + +public: + template ::Value>::Type> + Arg (Init) {} +}; + +class Lambda { + static constexpr int Unused = 0; + +public: + Lambda (Arg); +}; + +// Generated ref to Foo::mfun in the type die of an instantiation of this +template struct Callable {}; + +class I { + I() : lamb ([this] {}) {} + + Lambda lamb; + + Callable<&Foo::mfun> bm; +}; -- 2.30.2