The compiler does not inline calls to entities which are subprogram renamings. This is visible by means of the following small reproducer; compiling the main unit without this patch the compiler reported a the warning indicating "inlining failed in call to R.Value"
After this patch these sources are compiled silently. generic package G is function Value return Integer; pragma Inline (Value); end G; package body G is function Value2 return Integer is begin return 0; end; function Value return Integer renames Value2; end G; with G; package R is new G; with R; package Q is generic procedure Proc_G; end Q; package body Q is procedure Proc_G is C : constant Integer := R.Value; begin null; end; end Q; with Q; procedure P is procedure Proc is new Q.Proc_G; begin Proc; end; Command: gcc -c p.adb -O -gnatn2 -Winline Tested on x86_64-pc-linux-gnu, committed on trunk 2014-10-31 Javier Miranda <mira...@adacore.com> * inline.adb (Expand_Inlined_Call): Do not skip inlining of calls to subprogram renamings.
Index: inline.adb =================================================================== --- inline.adb (revision 216959) +++ inline.adb (working copy) @@ -2659,7 +2659,9 @@ -- Body_To_Inline is also set for renamings (see sinfo.ads) elsif Nkind (Orig_Bod) in N_Entity then - return; + if not Has_Pragma_Inline (Subp) then + return; + end if; -- Skip inlining if the function returns an unconstrained type using -- an extended return statement since this part of the new inlining