This patch fixes an issue in the compiler whereby a pragma Inline
appearing after a subprogram body stub to which it applies and where no
specification is present causes a compile time crash.

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

gcc/ada/

        * sem_ch6.adb (Check_Pragma_Inline): Correctly use
        Corresponding_Spec_Of_Stub when dealing subprogram body stubs.
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
@@ -3454,7 +3454,12 @@ package body Sem_Ch6 is
                   --  Link the body and the generated spec
 
                   Set_Corresponding_Body (Decl, Body_Id);
-                  Set_Corresponding_Spec (N, Subp);
+
+                  if Nkind (N) = N_Subprogram_Body_Stub then
+                     Set_Corresponding_Spec_Of_Stub (N, Subp);
+                  else
+                     Set_Corresponding_Spec (N, Subp);
+                  end if;
 
                   Set_Defining_Unit_Name (Specification (Decl), Subp);
 


Reply via email to