Commit 5e77b60a by Robert Dewar Committed by Arnaud Charlet

checks.adb (Apply_Array_Size_Check): Completely remove this for GCC 3, since we…

checks.adb (Apply_Array_Size_Check): Completely remove this for GCC 3, since we now expect GCC 3 to do all the work.

2005-03-17  Robert Dewar  <dewar@adacore.com>

	* checks.adb (Apply_Array_Size_Check): Completely remove this for GCC
	3, since we now expect GCC 3 to do all the work.

From-SVN: r96663
parent 5fa28bbb
......@@ -714,10 +714,6 @@ package body Checks is
-- Apply_Array_Size_Check --
----------------------------
-- Note: Really of course this entre check should be in the backend,
-- and perhaps this is not quite the right value, but it is good
-- enough to catch the normal cases (and the relevant ACVC tests!)
-- The situation is as follows. In GNAT 3 (GCC 2.x), the size in bits
-- is computed in 32 bits without an overflow check. That's a real
-- problem for Ada. So what we do in GNAT 3 is to approximate the
......@@ -726,8 +722,8 @@ package body Checks is
-- In GNAT 5, the size in byte is still computed in 32 bits without
-- an overflow check in the dynamic case, but the size in bits is
-- computed in 64 bits. We assume that's good enough, so we use the
-- size in bits for the test.
-- computed in 64 bits. We assume that's good enough, and we do not
-- bother to generate any front end test.
procedure Apply_Array_Size_Check (N : Node_Id; Typ : Entity_Id) is
Loc : constant Source_Ptr := Sloc (N);
......@@ -808,6 +804,14 @@ package body Checks is
-- Start of processing for Apply_Array_Size_Check
begin
-- Do size check on local arrays. We only need this in the GCC 2
-- case, since in GCC 3, we expect the back end to properly handle
-- things. This routine can be removed when we baseline GNAT 3.
if Opt.GCC_Version >= 3 then
return;
end if;
-- No need for a check if not expanding
if not Expander_Active then
......@@ -843,36 +847,6 @@ package body Checks is
end if;
end loop;
-- GCC 3 case
if Opt.GCC_Version = 3 then
-- No problem if size is known at compile time (even if the front
-- end does not know it) because the back end does do overflow
-- checking on the size in bytes if it is compile time known.
if Size_Known_At_Compile_Time (Typ) then
return;
end if;
end if;
-- Following code is temporarily deleted, since GCC 3 is returning
-- zero for size in bits of large dynamic arrays. ???
-- -- Otherwise we check for the size in bits exceeding 2**31-1 * 8.
-- -- This is the case in which we could end up with problems from
-- -- an unnoticed overflow in computing the size in bytes
--
-- Check_Siz := (Uint_2 ** 31 - Uint_1) * Uint_8;
--
-- Sizx :=
-- Make_Attribute_Reference (Loc,
-- Prefix => New_Occurrence_Of (Typ, Loc),
-- Attribute_Name => Name_Size);
-- GCC 2 case (for now this is for GCC 3 dynamic case as well)
begin
-- First step is to calculate the maximum number of elements. For
-- this calculation, we use the actual size of the subtype if it is
-- static, and if a bound of a subtype is non-static, we go to the
......@@ -978,9 +952,8 @@ package body Checks is
Make_Integer_Literal (Loc, J))));
Next_Index (Indx);
end loop;
end;
-- Common code to actually emit the check
-- Emit the check
Code :=
Make_Raise_Storage_Error (Loc,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment