https://gcc.gnu.org/g:92a5e7595d6e81f22cadb4ea1b8dc120d6e86ec8

commit r16-8976-g92a5e7595d6e81f22cadb4ea1b8dc120d6e86ec8
Author: Eric Botcazou <[email protected]>
Date:   Thu Jan 8 21:58:05 2026 +0100

    ada: Fix endless loop on Address aspect for object with dynamic address
    
    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.

Diff:
---
 gcc/ada/exp_util.adb | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index c2346844d0be..6909c65b34e2 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -12415,7 +12415,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);

Reply via email to