]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Freeze target type on qualified expression expansion
authorEtienne Servais <servais@adacore.com>
Mon, 14 Mar 2022 13:35:43 +0000 (14:35 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 16 May 2022 08:42:06 +0000 (08:42 +0000)
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.

gcc/ada/exp_ch4.adb

index 99fac5f8b6b5655fa35f4908c22a06af058e8afe..74d40e5affdbe0bcb66a155ca00e58006b4d5a5d 100644 (file)
@@ -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);