diff options
author | Ed Schonberg <schonberg@adacore.com> | 2020-09-09 08:40:25 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-10-26 04:58:52 -0400 |
commit | e8d6d5f039902653af5b04b58078bd1003acc624 (patch) | |
tree | e4f03c9095061fb88a975260ebd8065261ae287a /gcc | |
parent | 3b01ce303bf507adcfd320a63a7692e487b4d090 (diff) | |
download | gcc-e8d6d5f039902653af5b04b58078bd1003acc624.zip gcc-e8d6d5f039902653af5b04b58078bd1003acc624.tar.gz gcc-e8d6d5f039902653af5b04b58078bd1003acc624.tar.bz2 |
[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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/freeze.adb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index f3abba1..05a43c7 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 |