aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Servais <servais@adacore.com>2022-03-14 14:35:43 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-16 08:42:06 +0000
commit26bbf0e5da9af096eeddc2a79e1e0da9673b6bd2 (patch)
tree00cde0a16398c3296854b52f759f671a21255e00
parentc1e007985fef1389ba09f5b558aa4e7b9f03783f (diff)
downloadgcc-26bbf0e5da9af096eeddc2a79e1e0da9673b6bd2.zip
gcc-26bbf0e5da9af096eeddc2a79e1e0da9673b6bd2.tar.gz
gcc-26bbf0e5da9af096eeddc2a79e1e0da9673b6bd2.tar.bz2
[Ada] Freeze target type on qualified expression expansion
An object declaration (other than a deferred constant declaration) causes freezing where it occurs (13.14(6)), which means every name occurring within it causes freezing (13.14(4/1)), and when the name in a subtype_mark causes freezing, the denoted subtype is frozen (13.14(11)). Hence, one needs to freeze the target type when expanding a qualified expression. gcc/ada/ * exp_ch4.adb (Expand_N_Qualified_Expression): Freeze Target_Type.
-rw-r--r--gcc/ada/exp_ch4.adb2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 99fac5f..74d40e5 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -10776,6 +10776,8 @@ package body Exp_Ch4 is
Ensure_Valid (Operand);
end if;
+ Freeze_Before (Operand, Target_Type);
+
-- Apply possible constraint check
Apply_Constraint_Check (Operand, Target_Type, No_Sliding => True);