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 processing discriminants of private subtype


The compiler may crash processing a private tagged record type has
some component whose type is a subtype of a private type. After
this patch the following test compiles without errors.

package Other_Type is
   package BS is
      type Bounded_String is private;
   private
      type Super_String (Max_Length : Positive) is record
         null;
      end record;
      type Bounded_String is new Super_String (10);
   end;
   
   type S is new BS.Bounded_String;
end;

with Other_Type;
package Pkg is
   type Key_Type is private;
private
   type Key_Type is new Other_Type.S;
end;

package Pkg.Gen_Instance is
   type T is tagged null record;
private
   subtype A_T is Key_Type;
   type Derived is new T with record   -- Test
      X : A_T;
   end record;
end;

Command: gcc -c pkg-gen_instance.ads

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

2017-04-25  Javier Miranda  <miranda@adacore.com>

	* exp_ch3.adb (Build_Initialization_Call): Handle
	subtypes of private types when searching for the underlying full
	view of a private type.

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]