aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2017-12-22 19:04:18 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2017-12-22 19:04:18 +0100
commit14ec014e7614d927f5365704a2defaa3b9f44328 (patch)
tree1d0e411772a84b014560c0f0d6bdacd33b04ea34 /gcc/c
parent11d29d639f4b60f51a593932529be6895b613d4c (diff)
downloadgcc-14ec014e7614d927f5365704a2defaa3b9f44328.zip
gcc-14ec014e7614d927f5365704a2defaa3b9f44328.tar.gz
gcc-14ec014e7614d927f5365704a2defaa3b9f44328.tar.bz2
re PR debug/83550 (Bad location of DW_TAG_structure_type with forward declaration since r224161)
PR debug/83550 * c-decl.c (finish_struct): Set DECL_SOURCE_LOCATION on TYPE_STUB_DECL and call rest_of_type_compilation before processing incomplete vars rather than after it. * c-c++-common/dwarf2/pr83550.c: New test. From-SVN: r255981
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog5
-rw-r--r--gcc/c/c-decl.c16
2 files changed, 13 insertions, 8 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 581f7df..504205d 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,5 +1,10 @@
2017-12-22 Jakub Jelinek <jakub@redhat.com>
+ PR debug/83550
+ * c-decl.c (finish_struct): Set DECL_SOURCE_LOCATION on
+ TYPE_STUB_DECL and call rest_of_type_compilation before processing
+ incomplete vars rather than after it.
+
PR debug/83547
* c-typeck.c (c_finish_stmt_expr): Ignore !TREE_SIDE_EFFECTS as
indicator of ({ }), instead skip all trailing DEBUG_BEGIN_STMTs first,
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index e37ae17..846098e 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -8199,6 +8199,14 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
warning_at (loc, 0, "union cannot be made transparent");
}
+ /* Update type location to the one of the definition, instead of e.g.
+ a forward declaration. */
+ if (TYPE_STUB_DECL (t))
+ DECL_SOURCE_LOCATION (TYPE_STUB_DECL (t)) = loc;
+
+ /* Finish debugging output for this type. */
+ rest_of_type_compilation (t, toplevel);
+
/* If this structure or union completes the type of any previous
variable declaration, lay it out and output its rtl. */
for (x = incomplete_vars; x; x = TREE_CHAIN (x))
@@ -8215,14 +8223,6 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes,
}
}
- /* Update type location to the one of the definition, instead of e.g.
- a forward declaration. */
- if (TYPE_STUB_DECL (t))
- DECL_SOURCE_LOCATION (TYPE_STUB_DECL (t)) = loc;
-
- /* Finish debugging output for this type. */
- rest_of_type_compilation (t, toplevel);
-
/* If we're inside a function proper, i.e. not file-scope and not still
parsing parameters, then arrange for the size of a variable sized type
to be bound now. */