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] Inline_Always applied to a subprogram body without previous spec


When a pragma Inline_Always is applied to a subprogram body, the compiler
generates a spec to simplify subsequent inlinings of calls. The spec is
created by copying the analyzed spec of the body. There is no need for a
conformance spec between spec and body, and a conformance check may lead
to spurious conformance errors due to constant folding of static aggregates
in default expressions for formals.

The following must compile quietly:

procedure Inline is
   type R is record
      X, Y : Integer;
   end record;

   function Fun (It : R := (10, 20)) return Integer
   is
   begin
      return It.X + It.Y;
   end;
   pragma Inline_Always (Fun);

begin
   null;
end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-06-14  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch6.adb (Analyze_Subprogram_Body): Do not check conformance when
	the spec has been generated for a body without spec that carries an
	Inline_Always pragma.

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]