PR c/79969
* c-decl.c (start_enum): Adjust DECL_SOURCE_LOCATION of
TYPE_STUB_DECL.
* gcc.dg/debug/dwarf2/enum-loc1.c: New test.
From-SVN: r246009
+2017-03-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/79969
+ * c-decl.c (start_enum): Adjust DECL_SOURCE_LOCATION of
+ TYPE_STUB_DECL.
+
2017-03-07 Jakub Jelinek <jakub@redhat.com>
PR c/79834
enumtype = make_node (ENUMERAL_TYPE);
pushtag (loc, name, enumtype);
}
+ /* Update type location to the one of the definition, instead of e.g.
+ a forward declaration. */
+ else if (TYPE_STUB_DECL (enumtype))
+ DECL_SOURCE_LOCATION (TYPE_STUB_DECL (enumtype)) = loc;
if (C_TYPE_BEING_DEFINED (enumtype))
error_at (loc, "nested redefinition of %<enum %E%>", name);
+2017-03-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/79969
+ * gcc.dg/debug/dwarf2/enum-loc1.c: New test.
+
2017-03-09 Marek Polacek <polacek@redhat.com>
PR c++/79687
--- /dev/null
+/* PR c/79969 */
+/* { dg-do compile } */
+/* { dg-options "-gdwarf -dA -fno-merge-debug-strings" } */
+
+enum ENUMTAG;
+
+enum ENUMTAG
+{
+ B = 1,
+ C = 2
+};
+
+void
+bar (void)
+{
+ enum ENUMTAG a = C;
+}
+
+/* { dg-final { scan-assembler "DW_TAG_enumeration_type\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\"ENUMTAG\[^\\r\\n\]*DW_AT_name(\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*DW_AT_)*\[^\\r\\n\]*\[\\r\\n\]+\[^\\r\\n\]*\[^0-9a-fA-FxX](0x)?7\[^0-9a-fA-FxX]\[^\\r\\n\]*DW_AT_decl_line" } } */