2020-03-26 Jakub Jelinek <jakub@redhat.com>
+ PR debug/94323
+ * tree.c (protected_set_expr_location): Recurse on STATEMENT_LIST
+ that contains exactly one non-DEBUG_BEGIN_STMT statement.
+
PR debug/94281
* gimple.h (gimple_seq_first_nondebug_stmt): New function.
(gimple_seq_last_nondebug_stmt): Don't return NULL if seq contains
{
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. */