-- Shows stack some addresses with infinite recursion with Text_IO; use Text_IO; with System.Address_Image; with Ada.Exceptions; use Ada.Exceptions; procedure infrec is count : Natural := 0; procedure A is ai: Integer; -- Unitialized begin if count <= 3 then put_line("Address of ai: " & System.Address_Image(ai'address)); end if; count := count + 1; A; -- Infinite recursion! exception when e: others => put_line (exception_name (e) & ": " & exception_message (e)); put_line ("Count: " & count'img); put_line("Address of ai: " & System.Address_Image(ai'address)); end A; i: Integer; -- Address of i: BF98044C begin put_line("Address of i: " & System.Address_Image(i'address)); new_line; A; -- ai and Address of ai: -1080556592: BF980380 exception when e: others => new_line; put_line ("ERROR: " & exception_name (e) & ": " & exception_message (e)); end infrec; -- Address of i: BF82D658 -- -- Address of ai: BF82D2D0 -- Address of ai: BF82CE00 -- Address of ai: BF82C930 -- Address of ai: BF82C460 -- -- STORAGE_ERROR: stack overflow or erroneous memory access -- Count: 6806 -- Address of ai: BF02E5C0 -- Address of i: BFF937FC -- -- Address of ai: BFF934E0 -- Address of ai: BFF93170 -- Address of ai: BFF92E00 -- Address of ai: BFF92A90 -- STORAGE_ERROR: stack overflow or erroneous memory access -- Count: 9524 -- Address of ai: BF795590