The compiler may eventually silently skip inlining a non-tagged record type init proc because internally the frontend forgets to processing it. This issue generally does not occur since as soon as the frontend processes some unit that has pragma Inline the internal machinery which takes care of such processing is enabled (hence this problem reproduces only in small sources).
After this patch the following runs without output (which means that inlining is now performed in this case). package Test is function F return Natural; type No_Tagged_Rec is record Field1, Field2 : Integer := F; Field3, Field4 : Float := Float(F); end record; end Test; package body Test is Counter : Natural := 0; function F return Natural; begin Counter := Counter + 1; return Counter; end F; end Test; with Test; use Test; pragma Elaborate (Test); package Main is Global_Rec : No_Tagged_Rec; end Main; Command: gcc -gnatDG -S -O1 -gnat05 -gnatn -gnatp main.ads grep -i test__no_tagged_recIP main.s No output Tested on x86_64-pc-linux-gnu, committed on trunk 2015-10-16 Javier Miranda <mira...@adacore.com> * inline.adb (Add_Inlined_Body): Ensure that Analyze_Inlined_Bodies will be invoked after completing the analysis of the current unit.
Index: inline.adb =================================================================== --- inline.adb (revision 228864) +++ inline.adb (working copy) @@ -405,6 +405,11 @@ Pack : constant Entity_Id := Get_Code_Unit_Entity (E); begin + -- Ensure that Analyze_Inlined_Bodies will be invoked after + -- completing the analysis of the current unit. + + Inline_Processing_Required := True; + if Pack = E then -- Library-level inlined function. Add function itself to