Commit 4a0e6ac1 by Javier Miranda Committed by Pierre-Marie de Rodat

[Ada] Crash in interface derivation with null primitive

The frontend crashes processing the derivation of a tagged type whose
ultimate ancestor is an interface type I1 that has a null primitive,
implements another interface I2 derived from I2, and does not override
the null primitive.

2019-07-08  Javier Miranda  <miranda@adacore.com>

gcc/ada/

	* exp_disp.adb (Register_Primitive): When registering a
	primitive in the secondary dispatch table, handle primitive
	inherited through several levels of type derivation (required to
	properly handle inherited 'null' primitive).

gcc/testsuite/

	* gnat.dg/interface9.adb, gnat.dg/interface9_root-child.ads,
	gnat.dg/interface9_root.ads: New testcase.

From-SVN: r273204
parent 23eb3cb2
2019-07-08 Javier Miranda <miranda@adacore.com>
* exp_disp.adb (Register_Primitive): When registering a
primitive in the secondary dispatch table, handle primitive
inherited through several levels of type derivation (required to
properly handle inherited 'null' primitive).
2019-07-08 Bob Duff <duff@adacore.com> 2019-07-08 Bob Duff <duff@adacore.com>
* doc/gnat_ugn/gnat_utility_programs.rst: Document handling of * doc/gnat_ugn/gnat_utility_programs.rst: Document handling of
......
...@@ -7637,7 +7637,7 @@ package body Exp_Disp is ...@@ -7637,7 +7637,7 @@ package body Exp_Disp is
Unchecked_Convert_To (RTE (RE_Prim_Ptr), Unchecked_Convert_To (RTE (RE_Prim_Ptr),
Make_Attribute_Reference (Loc, Make_Attribute_Reference (Loc,
Prefix => Prefix =>
New_Occurrence_Of (Alias (Prim), Loc), New_Occurrence_Of (Ultimate_Alias (Prim), Loc),
Attribute_Name => Name_Unrestricted_Access)))); Attribute_Name => Name_Unrestricted_Access))));
end if; end if;
......
2019-07-08 Javier Miranda <miranda@adacore.com>
* gnat.dg/interface9.adb, gnat.dg/interface9_root-child.ads,
gnat.dg/interface9_root.ads: New testcase.
2019-07-08 Ed Schonberg <schonberg@adacore.com> 2019-07-08 Ed Schonberg <schonberg@adacore.com>
* gnat.dg/predicate9.adb: New testcase. * gnat.dg/predicate9.adb: New testcase.
......
-- { dg-do compile }
with Interface9_Root.Child;
procedure Interface9 is
package R is new Interface9_Root (Real => Float);
package RC is new R.Child;
begin
null;
end Interface9;
generic
package Interface9_Root.Child is
type Base_Type is abstract new Base_Interface with null record;
type Derived_Type is abstract new Base_Type and Derived_Interface
with null record; -- Test
end Interface9_Root.Child;
generic
type Real is digits <>;
package Interface9_Root is
type Base_Interface is limited interface;
procedure Primitive1 (B : in out Base_Interface) is abstract;
procedure Primitive2 (B : in out Base_Interface) is null;
type Derived_Interface is limited interface and Base_Interface;
end Interface9_Root;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment