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] Crash on inlined call to subprogram declared in package instance


This patch fixes a compiler crash on an inlined call in a nested instantiation
when the corresponding generic unit has aspect specifications.

The following must compile quietly:

   gcc -c inst.ads -gnatn -O

---
with Pointer;
package Inst is
   package I is new Pointer (Integer);
end;
---
package body Pointer is
   function Deref (Pointer : WI.W) return P is
   begin
      return WI.Load (Pointer);
   end;
end;
---
with Wrapper;
generic
   type Any_Type;
package Pointer is
   pragma Elaborate_Body;
   type P is access Any_Type;
   package WI is new Wrapper (P);
end;
---
package body Wrapper is
   function Load (A : W) return Data_Type is
   begin
      return A.Data;
   end;
end;
---
generic
   type Data_Type is private;
package Wrapper with Preelaborate
 is
   pragma Preelaborate;
   type W is record
      Data : Data_Type;
   end record;
   function Load (A : W) return Data_Type with Inline;
end;

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

2016-05-02  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch6.adb (Expand_Call): When inlining a call to a function
	declared in a package instance, locate the instance node of the
	package after the actual package declaration. skipping over
	pragmas that may have been introduced when the generic unit
	carries aspects that are transformed into pragmas.

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]