aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2018-11-14 19:30:47 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2018-11-14 19:30:47 +0000
commit89d9bf44969f8c244b0039d01e6546d9f43e8410 (patch)
treee24c92c7c661777a9703651f7a7e01ba10c13acd /gcc
parent1ded030b85ae26a11a062505786b6701d9ef588f (diff)
downloadgcc-89d9bf44969f8c244b0039d01e6546d9f43e8410.zip
gcc-89d9bf44969f8c244b0039d01e6546d9f43e8410.tar.gz
gcc-89d9bf44969f8c244b0039d01e6546d9f43e8410.tar.bz2
[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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/dwarf2out.c2
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/pr87462.C20
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/pr88006.C39
5 files changed, 75 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 568cdee..0bb3b84 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2018-11-14 Nathan Sidwell <nathan@acm.org>
+
+ PR debug/88006
+ PR debug/87462
+ * dwarf2out.c (dwarf2out_finish): Apply resolve_addr to comdat
+ type list.
+
2018-11-14 David Malcolm <dmalcolm@redhat.com>
* Makefile.in (CFLAGS-optinfo-emit-json.o): Add $(ZLIBINC).
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 8b478aa..aba8843 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 524db26..9d52f14 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2018-11-14 Nathan Sidwell <nathan@acm.org>
+
+ 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 <paolo.carlini@oracle.com>
* 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 0000000..bfbaad0
--- /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 <typename T,
+ T (*funcImpl)()>
+class TestWrapper {
+public:
+ static T func() __attribute((noinline)) { return (*funcImpl)(); }
+};
+
+int main() {
+ return TestWrapper<int, &Test1::testFunc>::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 0000000..86584e1
--- /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 <bool> struct B { typedef int Type; };
+
+class Arg
+{
+ template <typename Unused> struct Local : A {};
+
+public:
+ template <typename Init, typename = typename B<Local<Init>::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 <void (Foo::*unused)()> struct Callable {};
+
+class I {
+ I() : lamb ([this] {}) {}
+
+ Lambda lamb;
+
+ Callable<&Foo::mfun> bm;
+};