]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Relax assertion in compile-time evaluator
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 23 Oct 2025 10:11:35 +0000 (12:11 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 13 Nov 2025 15:26:58 +0000 (16:26 +0100)
A statically dead ELSIF branch can be rewritten either to a NULL statement or
entirely detached from its parent.

gcc/ada/ChangeLog:

* exp_util.adb (Get_Current_Value_Condition): Relax assertion about
rewritten ELSIF branch.

gcc/ada/exp_util.adb

index e2d2554d3a1f21a5c3b38d71296729a03693bed2..15e956469d46c288e42fc63b2f5e93614b0cebb6 100644 (file)
@@ -7641,13 +7641,11 @@ package body Exp_Util is
 
             begin
                --  An ELSIF part whose condition is false could have been
-               --  already rewritten into NULL statement and we are already
-               --  past the statements inside that ELSIF part.
+               --  already rewritten and we are already past the statements
+               --  inside that ELSIF part.
 
                if Nkind (If_Stmt) /= N_If_Statement then
-                  pragma Assert
-                    (Nkind (CV) = N_Elsif_Part
-                     and then Is_Rewrite_Substitution (If_Stmt));
+                  pragma Assert (Nkind (CV) = N_Elsif_Part);
                   return;
                end if;