This patch modifies the check which ensures that no call is executed in a preelaborated unit. The check now properly ignores a case where a generic unit is subject to pragma Remote_Call_Interface, and the call appears in the body.
Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ 2017-10-14 Hristian Kirtchev <kirtc...@adacore.com> * sem_elab.adb (In_Preelaborated_Context): A generic package subject to Remote_Call_Interface is not a suitable preelaboratd context when the call appears in the package body. gcc/testsuite/ 2017-10-14 Hristian Kirtchev <kirtc...@adacore.com> * gnat.dg/remote_call_iface.ads, gnat.dg/remote_call_iface.adb: New testcase.
Index: sem_elab.adb =================================================================== --- sem_elab.adb (revision 253757) +++ sem_elab.adb (working copy) @@ -1808,7 +1808,7 @@ -- be on another machine. if Ekind (Body_Id) = E_Package_Body - and then Ekind (Spec_Id) = E_Package + and then Ekind_In (Spec_Id, E_Generic_Package, E_Package) and then (Is_Remote_Call_Interface (Spec_Id) or else Is_Remote_Types (Spec_Id)) then Index: ../testsuite/gnat.dg/remote_call_iface.ads =================================================================== --- ../testsuite/gnat.dg/remote_call_iface.ads (revision 0) +++ ../testsuite/gnat.dg/remote_call_iface.ads (revision 0) @@ -0,0 +1,5 @@ +generic +package Remote_Call_Iface is + pragma Remote_Call_Interface; + procedure Proc; +end Remote_Call_Iface; Index: ../testsuite/gnat.dg/remote_call_iface.adb =================================================================== --- ../testsuite/gnat.dg/remote_call_iface.adb (revision 0) +++ ../testsuite/gnat.dg/remote_call_iface.adb (revision 0) @@ -0,0 +1,7 @@ +-- { dg-do compile } + +package body Remote_Call_Iface is + procedure Proc is begin null; end; +begin + Proc; +end Remote_Call_Iface;