https://gcc.gnu.org/g:0f048a684052e151741269642a1ea8111ff63b96

commit r16-2755-g0f048a684052e151741269642a1ea8111ff63b96
Author: Viljar Indus <in...@adacore.com>
Date:   Thu Jul 24 10:49:11 2025 +0300

    ada: Check Compile_Time_Errors removed in Ghost code
    
    gcc/ada/ChangeLog:
    
            * sem_prag.adb (Validate_Compile_Time_Warning_Errors):
            Check if the original compile time pragma was replaced and
            validate the original node instead.

Diff:
---
 gcc/ada/sem_prag.adb | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index c30bf424ae2d..62ef7560f791 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -35106,6 +35106,14 @@ package body Sem_Prag is
             Reset_Analyzed_Flags (T.Prag);
             if Nkind (T.Prag) = N_Pragma then
                Validate_Compile_Time_Warning_Or_Error (T.Prag, T.Eloc);
+            else
+               pragma Assert (Nkind (Original_Node (T.Prag)) = N_Pragma);
+
+               --  The pragma was likely removed in ignored ghost code. Check
+               --  the original node instead.
+
+               Validate_Compile_Time_Warning_Or_Error
+                 (Original_Node (T.Prag), T.Eloc);
             end if;
             Unset_Scope (T.Scope);
          end;

Reply via email to