public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix PR debug/47361
@ 2011-01-20 20:58 Dodji Seketeli
  2011-01-21 18:47 ` Jason Merrill
  0 siblings, 1 reply; 4+ messages in thread
From: Dodji Seketeli @ 2011-01-20 20:58 UTC (permalink / raw)
  To: Jason Merrill; +Cc: GCC Patches

Hello,

Consider the example below:

 typedef decltype (nullptr) nullptr_t;
 struct A
 {
   A (nullptr_t = 0);
 };
 A a;

When compiled with -std=gnu++0x -g -feliminate-dwarf2-dups it
crashes saying:
 internal compiler error: in build_abbrev_table, at dwarf2out.c:10477

At some point -feliminate-dwarf2-dups triggers break_out_includes that
assigns a symbol name to each type DIE that is referenced somewhere; and
later in build_abbrev_table that invariant [any referenced type DIE
should have a symbol name] is asserted.

The problem is nullptr is represented with a DW_TAG_unspecified_type
and that kind of DIE is not recognized as a type DIE and as a result
is not assigned a symbol name by break_out_include (via the call to
assign_symbol_names). So the invariant is not honoured.

The one-liner patch below makes DW_TAG_unspecified_type be recognized as
a type DIE.

Tested on x86_64-unknown-linux-gnu against trunk.

-- 
		Dodji

From 35b20c17096eb9c2838d5e14afc042370f882a26 Mon Sep 17 00:00:00 2001
From: Dodji Seketeli <dodji@redhat.com>
Date: Thu, 20 Jan 2011 15:14:05 +0100
Subject: [PATCH] Fix PR debug/47361

gcc/

	PR debug/47361
	* dwarf2out.c (is_type_die): Consider DW_TAG_unspecified_type as a
	type DIE.

gcc/testsuite/

	PR debug/47361
	* g++.dg/debug/dwarf2/nullptr-1.C: New test.
---
 gcc/dwarf2out.c                               |    1 +
 gcc/testsuite/g++.dg/debug/dwarf2/nullptr-1.C |   11 +++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/nullptr-1.C

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 2309297..bc4c12f 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -9618,6 +9618,7 @@ is_type_die (dw_die_ref die)
     case DW_TAG_packed_type:
     case DW_TAG_volatile_type:
     case DW_TAG_typedef:
+    case DW_TAG_unspecified_type:
       return 1;
     default:
       return 0;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/nullptr-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/nullptr-1.C
new file mode 100644
index 0000000..54f597e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/nullptr-1.C
@@ -0,0 +1,11 @@
+// Origin PR debug/47361
+// { dg-options "-g -std=gnu++0x -feliminate-dwarf2-dups" }
+
+typedef decltype (nullptr) nullptr_t;
+
+struct A
+{
+  A (nullptr_t = 0);
+};
+
+A a;
-- 
1.7.3.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-24 15:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-20 20:58 Fix PR debug/47361 Dodji Seketeli
2011-01-21 18:47 ` Jason Merrill
2011-01-24 14:45   ` Dodji Seketeli
2011-01-24 16:30     ` Dodji Seketeli

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).