aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2002-05-08 11:33:04 -0400
committerJason Merrill <jason@gcc.gnu.org>2002-05-08 11:33:04 -0400
commit29b91443e955b90f8c8ace2c4c4f1d7242abb4d5 (patch)
tree0aad108ce5fa34a70d37f19bc67a3ef24b870d2c
parent6c76b95000cf147f0155a6db1a92e4069cae5e68 (diff)
downloadgcc-29b91443e955b90f8c8ace2c4c4f1d7242abb4d5.zip
gcc-29b91443e955b90f8c8ace2c4c4f1d7242abb4d5.tar.gz
gcc-29b91443e955b90f8c8ace2c4c4f1d7242abb4d5.tar.bz2
re PR c++/6381 (Missing assembler label)
* dwarf2out.c (output_call_frame_info): Don't emit a CIE with no FDEs. * dwarf2out.c (gen_type_die): Abort on broken recursion. PR c++/6381 * dwarf2out.c (rtl_for_decl_location): Only expand INTEGER_CST and REAL_CST. From-SVN: r53295
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/dwarf2out.c20
-rw-r--r--gcc/testsuite/g++.dg/debug/const1.C11
3 files changed, 36 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 617d19d..5b2c5a8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2002-05-08 Jason Merrill <jason@redhat.com>
+
+ * dwarf2out.c (output_call_frame_info): Don't emit a CIE with no FDEs.
+
+ * dwarf2out.c (gen_type_die): Abort on broken recursion.
+
+ PR c++/6381
+ * dwarf2out.c (rtl_for_decl_location): Only expand INTEGER_CST and
+ REAL_CST.
+
2002-05-08 Nick Clifton <nickc@cambridge.redhat.com>
* config/arm/t-arm-elf (MULTILIB): Do not allow big-endian/
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 2b8e56c..9c0c634 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -1814,6 +1814,10 @@ output_call_frame_info (for_eh)
int per_encoding = DW_EH_PE_absptr;
int lsda_encoding = DW_EH_PE_absptr;
+ /* Don't emit a CIE if there won't be any FDEs. */
+ if (fde_table_in_use == 0)
+ return;
+
/* If we don't have any functions we'll want to unwind out of, don't emit any
EH unwind information. */
if (for_eh)
@@ -8946,15 +8950,17 @@ rtl_for_decl_location (decl)
== strlen (TREE_STRING_POINTER (init)) + 1))
rtl = gen_rtx_CONST_STRING (VOIDmode, TREE_STRING_POINTER (init));
}
-
- if (rtl == NULL)
+ /* If the initializer is something that we know will expand into an
+ immediate RTL constant, expand it now. Expanding anything else
+ tends to produce unresolved symbols; see debug/5770 and c++/6381. */
+ else if (TREE_CODE (DECL_INITIAL (decl)) == INTEGER_CST
+ || TREE_CODE (DECL_INITIAL (decl)) == REAL_CST)
{
rtl = expand_expr (DECL_INITIAL (decl), NULL_RTX, VOIDmode,
EXPAND_INITIALIZER);
- /* If expand_expr returned a MEM, we cannot use it, since
- it won't be output, leading to unresolved symbol. */
+ /* If expand_expr returns a MEM, it wasn't immediate. */
if (rtl && GET_CODE (rtl) == MEM)
- rtl = NULL;
+ abort ();
}
}
@@ -11071,6 +11077,10 @@ gen_type_die (type, context_die)
if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL
&& DECL_ORIGINAL_TYPE (TYPE_NAME (type)))
{
+ /* Prevent broken recursion; we can't hand off to the same type. */
+ if (DECL_ORIGINAL_TYPE (TYPE_NAME (type)) == type)
+ abort ();
+
TREE_ASM_WRITTEN (type) = 1;
gen_decl_die (TYPE_NAME (type), context_die);
return;
diff --git a/gcc/testsuite/g++.dg/debug/const1.C b/gcc/testsuite/g++.dg/debug/const1.C
new file mode 100644
index 0000000..7cbc571
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/const1.C
@@ -0,0 +1,11 @@
+// PR c++/6381
+// Bug: we were emitting the initializer for bar, which referenced foo,
+// which was not emitted.
+
+// { dg-options "-O" }
+// { dg-do link }
+
+static const int foo[] = { 0 };
+static const int * const bar[] = { foo };
+
+int main() {}