@@ -55,11 +55,14 @@ package System.Parameters is
-- Task And Stack Allocation Control --
---------------------------------------
- type Task_Storage_Size is new Integer;
- -- Type used in tasking units for task storage size
-
- type Size_Type is new Task_Storage_Size;
- -- Type used to provide task storage size to runtime
+ type Size_Type is range
+ -(2 ** (Integer'(Standard'Address_Size) - 1)) ..
+ +(2 ** (Integer'(Standard'Address_Size) - 1)) - 1;
+ -- Type used to provide task stack sizes to the runtime. Sized to permit
+ -- stack sizes of up to half the total addressable memory space. This may
+ -- seem excessively large (even for 32-bit systems), however there are many
+ -- instances of users requiring large stack sizes (for example string
+ -- processing).
Unspecified_Size : constant Size_Type := Size_Type'First;
-- Value used to indicate that no size type is set
@@ -53,11 +53,14 @@ package System.Parameters is
-- Task And Stack Allocation Control --
---------------------------------------
- type Task_Storage_Size is new Integer;
- -- Type used in tasking units for task storage size
-
- type Size_Type is new Task_Storage_Size;
- -- Type used to provide task storage size to runtime
+ type Size_Type is range
+ -(2 ** (Integer'(Standard'Address_Size) - 1)) ..
+ +(2 ** (Integer'(Standard'Address_Size) - 1)) - 1;
+ -- Type used to provide task stack sizes to the runtime. Sized to permit
+ -- stack sizes of up to half the total addressable memory space. This may
+ -- seem excessively large (even for 32-bit systems), however there are many
+ -- instances of users requiring large stack sizes (for example string
+ -- processing).
Unspecified_Size : constant Size_Type := Size_Type'First;
-- Value used to indicate that no size type is set
@@ -53,11 +53,14 @@ package System.Parameters is
-- Task And Stack Allocation Control --
---------------------------------------
- type Task_Storage_Size is new Integer;
- -- Type used in tasking units for task storage size
-
- type Size_Type is new Task_Storage_Size;
- -- Type used to provide task storage size to runtime
+ type Size_Type is range
+ -(2 ** (Integer'(Standard'Address_Size) - 1)) ..
+ +(2 ** (Integer'(Standard'Address_Size) - 1)) - 1;
+ -- Type used to provide task stack sizes to the runtime. Sized to permit
+ -- stack sizes of up to half the total addressable memory space. This may
+ -- seem excessively large (even for 32-bit systems), however there are many
+ -- instances of users requiring large stack sizes (for example string
+ -- processing).
Unspecified_Size : constant Size_Type := Size_Type'First;
-- Value used to indicate that no size type is set
@@ -53,11 +53,14 @@ package System.Parameters is
-- Task And Stack Allocation Control --
---------------------------------------
- type Task_Storage_Size is new Integer;
- -- Type used in tasking units for task storage size
-
- type Size_Type is new Task_Storage_Size;
- -- Type used to provide task storage size to runtime
+ type Size_Type is range
+ -(2 ** (Integer'(Standard'Address_Size) - 1)) ..
+ +(2 ** (Integer'(Standard'Address_Size) - 1)) - 1;
+ -- Type used to provide task stack sizes to the runtime. Sized to permit
+ -- stack sizes of up to half the total addressable memory space. This may
+ -- seem excessively large (even for 32-bit systems), however there are many
+ -- instances of users requiring large stack sizes (for example string
+ -- processing).
Unspecified_Size : constant Size_Type := Size_Type'First;
-- Value used to indicate that no size type is set
new file mode 100644
@@ -0,0 +1,26 @@
+-- { dg-do run }
+--
+-- This test checks that we can allocate more than 2GB on systems with word
+-- sizes larger than 32-bits
+
+with Ada.Strings.Fixed; use Ada.Strings.Fixed;
+
+procedure Sec_Stack1 is
+ function Get_A_Big_String return String;
+ -- Return a very close to 2GB string on the secondary stack that would
+ -- overflow the secondary stack if we still had a 2GB limit.
+
+ function Get_A_Big_String return String is
+ String_Size : constant Natural := Natural'Last;
+ begin
+ return String_Size * 'a';
+ end Get_A_Big_String;
+
+begin
+ -- This test only works on systems with more than 32-bits
+ if Standard'Address_Size > 32 then
+ declare
+ R : String := Get_A_Big_String;
+ begin null; end;
+ end if;
+end Sec_Stack1;