aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index f38dfff..63dc673 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5146,6 +5146,33 @@ protected_set_expr_location (tree t, location_t loc)
{
if (CAN_HAVE_LOCATION_P (t))
SET_EXPR_LOCATION (t, loc);
+ else if (t && TREE_CODE (t) == STATEMENT_LIST)
+ {
+ /* With -gstatement-frontiers we could have a STATEMENT_LIST with
+ DEBUG_BEGIN_STMT(s) and only a single other stmt, which with
+ -g wouldn't be present and we'd have that single other stmt
+ directly instead. */
+ struct tree_statement_list_node *n = STATEMENT_LIST_HEAD (t);
+ if (!n)
+ return;
+ while (TREE_CODE (n->stmt) == DEBUG_BEGIN_STMT)
+ {
+ n = n->next;
+ if (!n)
+ return;
+ }
+ tree t2 = n->stmt;
+ do
+ {
+ n = n->next;
+ if (!n)
+ {
+ protected_set_expr_location (t2, loc);
+ return;
+ }
+ }
+ while (TREE_CODE (n->stmt) == DEBUG_BEGIN_STMT);
+ }
}
/* Data used when collecting DECLs and TYPEs for language data removal. */