aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/dwarf2out.cc15
-rw-r--r--gcc/testsuite/c-c++-common/pr107058.c7
2 files changed, 18 insertions, 4 deletions
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 0b8a300..2b72321 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -6061,10 +6061,17 @@ dwarf2out_die_ref_for_decl (tree decl, const char **sym,
die = die->die_parent;
/* For the containing CU DIE we compute a die_symbol in
compute_comp_unit_symbol. */
- gcc_assert (die->die_tag == DW_TAG_compile_unit
- && die->die_id.die_symbol != NULL);
- *sym = die->die_id.die_symbol;
- return true;
+ if (die->die_tag == DW_TAG_compile_unit)
+ {
+ gcc_assert (die->die_id.die_symbol != NULL);
+ *sym = die->die_id.die_symbol;
+ return true;
+ }
+ /* While we can gracefully handle running into say a type unit
+ we don't really want and consider this a bug. */
+ if (flag_checking)
+ gcc_unreachable ();
+ return false;
}
/* Add a reference of kind ATTR_KIND to a DIE at SYMBOL + OFFSET to DIE. */
diff --git a/gcc/testsuite/c-c++-common/pr107058.c b/gcc/testsuite/c-c++-common/pr107058.c
new file mode 100644
index 0000000..5e625d6
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr107058.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lto } */
+/* { dg-options "-g -fdebug-types-section -flto -fno-checking" } */
+
+/* We should handle the C++ FE issue gracefully with -fno-checking. */
+
+#include "pr50459.c"