mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-31 15:31:11 +08:00
g-dyntab.adb, [...]: (Set_Item): Suppress Range_Check on Allocated_Table.
2007-08-16 Thomas Quinot <quinot@adacore.com> * g-dyntab.adb, g-table.adb, table.adb: (Set_Item): Suppress Range_Check on Allocated_Table. From-SVN: r127541
This commit is contained in:
parent
d48365bc6c
commit
c17fc6f62a
@ -249,10 +249,20 @@ package body GNAT.Dynamic_Tables is
|
||||
|
||||
Allocated_Table : Allocated_Table_T;
|
||||
pragma Import (Ada, Allocated_Table);
|
||||
pragma Suppress (Range_Check, On => Allocated_Table);
|
||||
for Allocated_Table'Address use Allocated_Table_Address;
|
||||
-- Allocated_Table represents the currently allocated array, plus one
|
||||
-- element (the supplementary element is used to have a convenient way
|
||||
-- to the address just past the end of the current allocation).
|
||||
-- to the address just past the end of the current allocation). Range
|
||||
-- checks are suppressed because this unit uses direct calls to
|
||||
-- System.Memory for allocation, and this can yield misaligned storage
|
||||
-- (and we cannot rely on the bootstrap compiler supporting specifically
|
||||
-- disabling alignment cheks, so we need to suppress all range checks).
|
||||
-- It is safe to suppress this check here because we know that a
|
||||
-- (possibly misaligned) object of that type does actually exist at that
|
||||
-- address.
|
||||
-- ??? We should really improve the allocation circuitry here to
|
||||
-- guarantee proper alignment.
|
||||
|
||||
Need_Realloc : constant Boolean := Integer (Index) > T.P.Max;
|
||||
-- True if this operation requires storage reallocation (which may
|
||||
|
@ -248,11 +248,20 @@ package body GNAT.Table is
|
||||
|
||||
Allocated_Table : Allocated_Table_T;
|
||||
pragma Import (Ada, Allocated_Table);
|
||||
pragma Suppress (Range_Check, On => Allocated_Table);
|
||||
for Allocated_Table'Address use Allocated_Table_Address;
|
||||
-- Allocated_Table represents the currently allocated array, plus
|
||||
-- one element (the supplementary element is used to have a
|
||||
-- convenient way of computing the address just past the end of the
|
||||
-- current allocation).
|
||||
-- current allocation). Range checks are suppressed because this unit
|
||||
-- uses direct calls to System.Memory for allocation, and this can
|
||||
-- yield misaligned storage (and we cannot rely on the bootstrap
|
||||
-- compiler supporting specifically disabling alignment cheks, so we
|
||||
-- need to suppress all range checks). It is safe to suppress this check
|
||||
-- here because we know that a (possibly misaligned) object of that type
|
||||
-- does actually exist at that address.
|
||||
-- ??? We should really improve the allocation circuitry here to
|
||||
-- guarantee proper alignment.
|
||||
|
||||
Need_Realloc : constant Boolean := Integer (Index) > Max;
|
||||
-- True if this operation requires storage reallocation (which may
|
||||
|
@ -287,11 +287,20 @@ package body Table is
|
||||
|
||||
Allocated_Table : Allocated_Table_T;
|
||||
pragma Import (Ada, Allocated_Table);
|
||||
pragma Suppress (Range_Check, On => Allocated_Table);
|
||||
for Allocated_Table'Address use Allocated_Table_Address;
|
||||
-- Allocated_Table represents the currently allocated array, plus one
|
||||
-- element (the supplementary element is used to have a convenient
|
||||
-- way of computing the address just past the end of the current
|
||||
-- allocation).
|
||||
-- allocation). Range checks are suppressed because this unit
|
||||
-- uses direct calls to System.Memory for allocation, and this can
|
||||
-- yield misaligned storage (and we cannot rely on the bootstrap
|
||||
-- compiler supporting specifically disabling alignment cheks, so we
|
||||
-- need to suppress all range checks). It is safe to suppress this
|
||||
-- check here because we know that a (possibly misaligned) object
|
||||
-- of that type does actually exist at that address.
|
||||
-- ??? We should really improve the allocation circuitry here to
|
||||
-- guarantee proper alignment.
|
||||
|
||||
Need_Realloc : constant Boolean := Int (Index) > Max;
|
||||
-- True if this operation requires storage reallocation (which may
|
||||
|
Loading…
x
Reference in New Issue
Block a user