Tested x86_64-pc-linux-gnu, applying to trunk.

-- 8< --

21_strings/basic_string/operations/contains/nonnull.cc was failing because
the module was built with debug markers and the testcase was built not
expecting debug markers, so we crashed in lower_stmt.  Let's accommodate
this by discarding debug marker statements we don't want.

gcc/cp/ChangeLog:

        * module.cc (trees_in::core_vals) [STATEMENT_LIST]: Skip
        DEBUG_BEGIN_STMT if !MAY_HAVE_DEBUG_MARKER_STMTS.
---
 gcc/cp/module.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 4136fdceb9f..3b25f956928 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -6895,7 +6895,12 @@ trees_in::core_vals (tree t)
       {
        tree_stmt_iterator iter = tsi_start (t);
        for (tree stmt; RT (stmt);)
-         tsi_link_after (&iter, stmt, TSI_CONTINUE_LINKING);
+         {
+           if (TREE_CODE (stmt) == DEBUG_BEGIN_STMT
+               && !MAY_HAVE_DEBUG_MARKER_STMTS)
+             continue;
+           tsi_link_after (&iter, stmt, TSI_CONTINUE_LINKING);
+         }
       }
       break;
 

base-commit: 806563f11eb7a677468f0ef40864da6f749b05a8
prerequisite-patch-id: 31e3d047a448e14e52ee30721009e58feb3633e3
-- 
2.47.0

Reply via email to