]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
analyzer: fix check against --param=analyzer-bb-explosion-factor=0
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 16 Jan 2026 15:54:32 +0000 (10:54 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 16 Jan 2026 15:54:32 +0000 (10:54 -0500)
analyzer.texi documents --param=analyzer-bb-explosion-factor=0 as a way
to make the analysis bail out early, but I broke this in
r16-6063-g0b786d961d4426.

Fix thusly.

gcc/analyzer/ChangeLog:
* engine.cc (exploded_graph::process_worklist): Remove guard on
limit being non-zero when checking for -Wanalyzer-too-complex
on overall number of exploded nodes.  Allow for the origin enode.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/analyzer/engine.cc

index 5222f9e32dd68d39db58ab9af5cf0ca50f954ee4..2d22abf05303337f728f576d4f75bbc53fdff011 100644 (file)
@@ -3400,19 +3400,22 @@ exploded_graph::process_worklist ()
       /* Impose a hard limit on the number of exploded nodes, to ensure
         that the analysis terminates in the face of pathological state
         explosion (or bugs).  */
-      if (const int limit
-           = m_sg.num_nodes () * param_analyzer_bb_explosion_factor)
-       if (m_global_stats.m_num_nodes > limit)
-         {
-           if (logger)
-             logger->log ("bailing out; too many nodes");
-           warning_at (node->get_point ().get_location (),
-                       OPT_Wanalyzer_too_complex,
-                       "analysis bailed out early"
-                       " (%i enodes)",
-                       m_nodes.length ());
-           return;
-         }
+      const int limit
+       = (// Per-supernode limit:
+          (m_sg.num_nodes () * param_analyzer_bb_explosion_factor)
+          // Allow one for the "origin" enode:
+          + 1);
+      if (m_global_stats.m_num_nodes > limit)
+       {
+         if (logger)
+           logger->log ("bailing out; too many nodes");
+         warning_at (node->get_point ().get_location (),
+                     OPT_Wanalyzer_too_complex,
+                     "analysis bailed out early"
+                     " (%i enodes)",
+                     m_nodes.length ());
+         return;
+       }
     }
 }