Debian Codegraph @

gcc/testsuite/gnat.dg/sec_stack1.adb

raw
1 -- { dg-do run }
2 --
3 -- This test checks that we can allocate more than 2GB on systems with word
4 -- sizes larger than 32-bits
5
6 with Ada.Strings.Fixed; use Ada.Strings.Fixed;
7
8 procedure Sec_Stack1 is
9 function Get_A_Big_String return String;
10 -- Return a very close to 2GB string on the secondary stack that would
11 -- overflow the secondary stack if we still had a 2GB limit.
12
13 function Get_A_Big_String return String is
14 String_Size : constant Natural := Natural'Last;
15 begin
16 return String_Size * 'a';
17 end Get_A_Big_String;
18
19 begin
20 -- This test only works on systems with more than 32-bits
21 if Standard'Address_Size > 32 then
22 declare
23 R : String := Get_A_Big_String;
24 begin null; end;
25 end if;
26 end Sec_Stack1;