]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Check Compile_Time_Errors removed in Ghost code
authorViljar Indus <indus@adacore.com>
Thu, 24 Jul 2025 07:49:11 +0000 (10:49 +0300)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 4 Aug 2025 13:04:11 +0000 (15:04 +0200)
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.

gcc/ada/sem_prag.adb

index c30bf424ae2ddeb394c758cc38c626d9daed091f..62ef7560f7913d937a33fd83c8ac75c209f3bfcd 100644 (file)
@@ -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;