https://gcc.gnu.org/g:5200b096cedd09a51fecffebc19ae699d2d5a160

commit r17-1168-g5200b096cedd09a51fecffebc19ae699d2d5a160
Author: Viljar Indus <[email protected]>
Date:   Tue Mar 31 12:04:37 2026 +0300

    ada: Avoid giving multiple errors on ghost argument
    
    Avoid marking multiple errors on the same line if the ghost
    expression is both non-static and also would evaluate to False.
    
    gcc/ada/ChangeLog:
    
            * sem_prag.adb (Analyze_Abstract_State): make error checks
            exclusive.

Diff:
---
 gcc/ada/sem_prag.adb | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index e3f1ed0e0856..a22ae61cd55b 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -13595,9 +13595,7 @@ package body Sem_Prag is
                                           & "in pragma % "
                                           & "must be static"),
                                        Expr);
-                                 end if;
-
-                                 if Is_False (Expr_Value (Expr)) then
+                                 elsif Is_False (Expr_Value (Expr)) then
                                     Is_Ghost := False;
 
                                     --  "Ghostness" cannot be turned off once

Reply via email to