This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Missing inlining of init_proc


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  <miranda@adacore.com>

	* inline.adb (Add_Inlined_Body): Ensure that
	Analyze_Inlined_Bodies will be invoked after completing the
	analysis of the current unit.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]