diff mbox series

[Ada] Assert failure on pragma Inline in procedure body

Message ID 20210506075812.GA125635@adacore.com
State New
Headers show
Series [Ada] Assert failure on pragma Inline in procedure body | expand

Commit Message

Pierre-Marie de Rodat May 6, 2021, 7:58 a.m. UTC
Is_Inline_Pragma isn't always dealing properly with N not being a list
member and Spec_Id being null. This is now fixed.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_ch6.adb (Is_Inline_Pragma): Protect against N not being a
	list member in both branches.
diff mbox series

Patch

diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -3416,15 +3416,13 @@  package body Sem_Ch6 is
             Prag := Empty;
          end if;
 
-         if Present (Prag) then
+         if Present (Prag) and then Is_List_Member (N) then
             if Present (Spec_Id) then
-               if Is_List_Member (N)
-                 and then Is_List_Member (Unit_Declaration_Node (Spec_Id))
+               if Is_List_Member (Unit_Declaration_Node (Spec_Id))
                  and then In_Same_List (N, Unit_Declaration_Node (Spec_Id))
                then
                   Analyze (Prag);
                end if;
-
             else
                --  Create a subprogram declaration, to make treatment uniform.
                --  Make the sloc of the subprogram name that of the entity in