aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSterling Augustine <saugustine@google.com>2012-06-26 17:54:02 +0000
committerSterling Augustine <sterling@gcc.gnu.org>2012-06-26 17:54:02 +0000
commitd44f5f2552521a65d9b1c603f8eac836d4864c1d (patch)
tree652a2faa5f2b08b4e47e4a933a3f4f0e5a55256d
parent01a07a642e8b9435327efc7d603fa5bf849a8c25 (diff)
downloadgcc-d44f5f2552521a65d9b1c603f8eac836d4864c1d.zip
gcc-d44f5f2552521a65d9b1c603f8eac836d4864c1d.tar.gz
gcc-d44f5f2552521a65d9b1c603f8eac836d4864c1d.tar.bz2
dwarf2out.c (output_pubnames): Add check for DW_TAG_enumerator.
2012-06-26 Sterling Augustine <saugustine@google.com> * dwarf2out.c (output_pubnames): Add check for DW_TAG_enumerator. (prune_unused_types): Likewise. From-SVN: r188992
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/dwarf2out.c15
2 files changed, 17 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cd78a2a..3944f3c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-26 Sterling Augustine <saugustine@google.com>
+
+ * dwarf2out.c (output_pubnames): Add check for DW_TAG_enumerator.
+ (prune_unused_types): Likewise.
+
2012-06-26 Steven Bosscher <steven@gcc.gnu.org>
* system.h (UNALIGNED_SHORT_ASM_OP, UNALIGNED_INT_ASM_OP,
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 015422e..fc0659b 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -8284,6 +8284,12 @@ output_pubnames (VEC (pubname_entry, gc) * names)
FOR_EACH_VEC_ELT (pubname_entry, names, i, pub)
{
+ /* Enumerator names are part of the pubname table, but the parent
+ DW_TAG_enumeration_type die may have been pruned. Don't output
+ them if that is the case. */
+ if (pub->die->die_tag == DW_TAG_enumerator && !pub->die->die_mark)
+ continue;
+
/* We shouldn't see pubnames for DIEs outside of the main CU. */
if (names == pubname_table)
gcc_assert (pub->die->die_mark);
@@ -21239,10 +21245,13 @@ prune_unused_types (void)
prune_unused_types_mark (ctnode->type_die, 1);
}
- /* Also set the mark on nodes referenced from the
- pubname_table. */
+ /* Also set the mark on nodes referenced from the pubname_table. Enumerators
+ are unusual in that they are pubnames that are the children of pubtypes.
+ They should only be marked via their parent DW_TAG_enumeration_type die,
+ not as roots in themselves. */
FOR_EACH_VEC_ELT (pubname_entry, pubname_table, i, pub)
- prune_unused_types_mark (pub->die, 1);
+ if (pub->die->die_tag != DW_TAG_enumerator)
+ prune_unused_types_mark (pub->die, 1);
for (i = 0; VEC_iterate (dw_die_ref, base_types, i, base_type); i++)
prune_unused_types_mark (base_type, 1);