Fix crash on access-to-incomplete type
This just adds the missing guard. gcc/ada/ PR ada/114708 * exp_util.adb (Finalize_Address): Add guard for incomplete types. gcc/testsuite/ * gnat.dg/incomplete8.adb: New test.
This commit is contained in:
parent
72a59a1b8d
commit
b5ad4431f9
2 changed files with 28 additions and 0 deletions
|
@ -6076,6 +6076,12 @@ package body Exp_Util is
|
|||
|
||||
Utyp := Underlying_Type (Base_Type (Utyp));
|
||||
|
||||
-- Handle incomplete types
|
||||
|
||||
if No (Utyp) then
|
||||
return Empty;
|
||||
end if;
|
||||
|
||||
-- Deal with untagged derivation of private views. If the parent is
|
||||
-- now known to be protected, the finalization routine is the one
|
||||
-- defined on the corresponding record of the ancestor (corresponding
|
||||
|
|
22
gcc/testsuite/gnat.dg/incomplete8.adb
Normal file
22
gcc/testsuite/gnat.dg/incomplete8.adb
Normal file
|
@ -0,0 +1,22 @@
|
|||
-- PR ada/114708
|
||||
-- Reported by Jere <jhb.chat@gmail.com>
|
||||
|
||||
-- { dg-do compile }
|
||||
|
||||
procedure Incomplete8 is
|
||||
|
||||
generic
|
||||
type Element_Type(<>);
|
||||
package Test_Incomplete_Formal is
|
||||
type Element_Access is access Element_Type;
|
||||
end Test_Incomplete_Formal;
|
||||
|
||||
type Node;
|
||||
|
||||
package P is new Test_Incomplete_Formal(Node);
|
||||
|
||||
type Node is limited null record;
|
||||
|
||||
begin
|
||||
null;
|
||||
end;
|
Loading…
Add table
Reference in a new issue