From: Ed Schonberg Date: Wed, 9 Sep 2020 12:40:25 +0000 (-0400) Subject: [Ada] Crash on membership test in expression function X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e8d6d5f039902653af5b04b58078bd1003acc624;p=gcc.git [Ada] Crash on membership test in expression function gcc/ada/ * freeze.adb (Freeze_Type_Refs): When an entity in an expression function is a type, freeze the entity and not just its type, which would be incomplete when the type is derived and/or tagged. --- diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index f3abba1538d..05a43c741a6 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -7978,7 +7978,16 @@ package body Freeze is -- Check that a type referenced by an entity can be frozen if Is_Entity_Name (Node) and then Present (Entity (Node)) then - Check_And_Freeze_Type (Etype (Entity (Node))); + -- The entity itself may be a type, as in a membership test + -- or an attribute reference. Freezing its own type would be + -- incomplete if the entity is derived or an extension. + + if Is_Type (Entity (Node)) then + Check_And_Freeze_Type (Entity (Node)); + + else + Check_And_Freeze_Type (Etype (Entity (Node))); + end if; -- Check that the enclosing record type can be frozen