https://gcc.gnu.org/g:5ecea59621c63abdfdb4c91f8c37ab68b40b5b75

commit r16-256-g5ecea59621c63abdfdb4c91f8c37ab68b40b5b75
Author: David Malcolm <dmalc...@redhat.com>
Date:   Mon Apr 28 18:21:20 2025 -0400

    analyzer: fail if we see unexpected gimple stmt codes
    
    gcc/analyzer/ChangeLog:
            * region-model.cc (region_model::on_stmt_pre): Use internal_error
            if we see an unexpected gimple stmt code.
    
    Signed-off-by: David Malcolm <dmalc...@redhat.com>

Diff:
---
 gcc/analyzer/region-model.cc | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-model.cc
index 84b81e968002..9583ba6663ba 100644
--- a/gcc/analyzer/region-model.cc
+++ b/gcc/analyzer/region-model.cc
@@ -1570,13 +1570,15 @@ region_model::on_stmt_pre (const gimple *stmt,
 {
   switch (gimple_code (stmt))
     {
-    default:
-      /* No-op for now.  */
-      break;
-
-    case GIMPLE_DEBUG:
-      /* We should have stripped these out when building the supergraph.  */
-      gcc_unreachable ();
+    case GIMPLE_COND:
+    case GIMPLE_EH_DISPATCH:
+    case GIMPLE_GOTO:
+    case GIMPLE_LABEL:
+    case GIMPLE_NOP:
+    case GIMPLE_PREDICT:
+    case GIMPLE_RESX:
+    case GIMPLE_SWITCH:
+      /* No-ops here.  */
       break;
 
     case GIMPLE_ASSIGN:
@@ -1611,6 +1613,13 @@ region_model::on_stmt_pre (const gimple *stmt,
        on_return (return_, ctxt);
       }
       break;
+
+    /* We don't expect to see any other statement kinds in the analyzer.  */
+    case GIMPLE_DEBUG: // should have stripped these out when building the 
supergraph
+    default:
+      internal_error ("unexpected gimple stmt code: %qs",
+                     gimple_code_name[gimple_code (stmt)]);
+      break;
     }
 }

Reply via email to