A type that implements interfaces generates internal procedures ("thunks") that access the dispatch table to retrieve the proper operation on a dispatching call. This patch fixes a bug in the handling of these thunks, when one of its formals has a limited view of a type. Usually the presence of such a type forces a delay in generating code for the subprogram, but this delay must not be applied to a thunk.
The following must compile quietly: gcc -c p.ads --- with Q; package P is type Instance is new Q.Instance with null record; end P; --- with R; with S; limited with T; package Q is type Instance is new R.Instance and S.Instance with null record; procedure Proc (Self : Instance; Current : T.Instance); end Q; --- package R is type Instance is tagged null record; end R; --- limited with T; package S is type Instance is interface; procedure Proc (Self : Instance; Current : T.Instance) is abstract; end S; --- package T is type Instance is tagged null record; end T; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-10-23 Ed Schonberg <schonb...@adacore.com> * sem_ch6.adb (Process_Formals): A thunk procedure with a parameter of a limited view does not need a freeze node.
Index: sem_ch6.adb =================================================================== --- sem_ch6.adb (revision 216584) +++ sem_ch6.adb (working copy) @@ -9946,7 +9946,9 @@ -- (Note that the same is done for controlling access -- parameter cases in function Access_Definition.) - Set_Has_Delayed_Freeze (Current_Scope); + if not Is_Thunk (Current_Scope) then + Set_Has_Delayed_Freeze (Current_Scope); + end if; end if; end if;