From: Viljar Indus <in...@adacore.com> 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. Tested on x86_64-pc-linux-gnu, committed on master. --- 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 c30bf424ae2..62ef7560f79 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; -- 2.43.0