Blame SOURCES/gcc48-pr79969.patch

56d343
2017-03-09  Jakub Jelinek  <jakub@redhat.com>
56d343
56d343
	PR c/79969
56d343
	* c-decl.c (start_enum): Adjust DECL_SOURCE_LOCATION of
56d343
	TYPE_STUB_DECL.
56d343
56d343
	* gcc.dg/debug/dwarf2/enum-loc1.c: New test.
56d343
56d343
--- gcc/c/c-decl.c.jj	2017-03-05 22:39:45.000000000 +0100
56d343
+++ gcc/c/c-decl.c	2017-03-09 08:19:33.100042166 +0100
56d343
@@ -8201,6 +8201,10 @@ start_enum (location_t loc, struct c_enu
56d343
       enumtype = make_node (ENUMERAL_TYPE);
56d343
       pushtag (loc, name, enumtype);
56d343
     }
56d343
+  /* Update type location to the one of the definition, instead of e.g.
56d343
+     a forward declaration.  */
56d343
+  else if (TYPE_STUB_DECL (enumtype))
56d343
+    DECL_SOURCE_LOCATION (TYPE_STUB_DECL (enumtype)) = loc;
56d343
 
56d343
   if (C_TYPE_BEING_DEFINED (enumtype))
56d343
     error_at (loc, "nested redefinition of %<enum %E%>", name);
56d343
--- gcc/testsuite/gcc.dg/debug/dwarf2/enum-loc1.c.jj	2017-03-09 08:09:30.742037844 +0100
56d343
+++ gcc/testsuite/gcc.dg/debug/dwarf2/enum-loc1.c	2017-03-09 08:16:45.202268438 +0100
56d343
@@ -0,0 +1,19 @@
56d343
+/* PR c/79969 */
56d343
+/* { dg-do compile } */
56d343
+/* { dg-options "-gdwarf-2 -dA -fno-merge-debug-strings" } */
56d343
+
56d343
+enum ENUMTAG;
56d343
+
56d343
+enum ENUMTAG
56d343
+{
56d343
+  B = 1,
56d343
+  C = 2
56d343
+};
56d343
+
56d343
+void
56d343
+bar (void)
56d343
+{
56d343
+  enum ENUMTAG a = C;
56d343
+}
56d343
+
56d343
+/* { 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" } } */