From 193040a071b1170e5e22b7371d81b880f69aeae1 Mon Sep 17 00:00:00 2001 From: Ghjuvan Lacambre Date: Fri, 9 Oct 2020 16:36:45 +0200 Subject: [PATCH] [Ada] Fix crash on invalid `pragma Profile` gcc/ada/ * sem_prag.adb (Analyze_Pragma): Emit error on wrong argument nkind. --- gcc/ada/sem_prag.adb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 5a2dffff0f4..eda8898bdb3 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -21494,7 +21494,11 @@ package body Sem_Prag is Argx : constant Node_Id := Get_Pragma_Arg (Arg1); begin - if Chars (Argx) = Name_Ravenscar then + if Nkind (Argx) /= N_Identifier then + Error_Msg_N + ("argument of pragma Profile must be an identifier", N); + + elsif Chars (Argx) = Name_Ravenscar then Set_Ravenscar_Profile (Ravenscar, N); elsif Chars (Argx) = Name_Jorvik then -- 2.30.2