]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix endless loop on Address aspect for object with dynamic address
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 8 Jan 2026 20:58:05 +0000 (21:58 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 25 May 2026 08:28:07 +0000 (10:28 +0200)
The freezing machinery ends up inserting a freeze node into its own Actions
list, which causes Expand_N_Freeze_Entity to enter an endless loop, because
Remove_Init_Call incorrectly returns the initialization call of a different
variable than the one for which it was invoked.

gcc/ada/ChangeLog:

* exp_util.adb (Remove_Init_Call.Find_Init_Call_In_List): Check that
the first actual denotes the expected variable modulo qualification
and conversion.

gcc/ada/exp_util.adb

index 7605ff9e576c11d64e3495206c047218a12f7229..d93e3b10017d9746cd52825b1f48ba56ca56eb01 100644 (file)
@@ -12542,7 +12542,15 @@ package body Exp_Util is
               and then Is_Entity_Name (Name (Init_Call))
               and then Entity (Name (Init_Call)) = Init_Proc
             then
-               return Init_Call;
+               declare
+                  Act : constant Node_Id :=
+                    Unqual_Conv (First (Parameter_Associations (Init_Call)));
+
+               begin
+                  if Is_Entity_Name (Act) and then Entity (Act) = Var then
+                     return Init_Call;
+                  end if;
+               end;
             end if;
 
             Next (Init_Call);