diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-16 12:19:02 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-16 12:19:02 +0000 |
commit | 46389718023143dbbc3864ba453610e61074f2e3 (patch) | |
tree | da148d343ee2c3ee9cc41ed3858d1a899e922588 /gcc/ada | |
parent | 424dddae237d7adcf037761c1fa8add783a9313f (diff) | |
download | gcc-46389718023143dbbc3864ba453610e61074f2e3.tar.gz |
2007-08-16 Thomas Quinot <quinot@adacore.com>
* g-dyntab.adb, g-table.adb, table.adb: (Set_Item): Suppress
Range_Check on Allocated_Table.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127541 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/g-dyntab.adb | 12 | ||||
-rw-r--r-- | gcc/ada/g-table.adb | 11 | ||||
-rw-r--r-- | gcc/ada/table.adb | 11 |
3 files changed, 31 insertions, 3 deletions
diff --git a/gcc/ada/g-dyntab.adb b/gcc/ada/g-dyntab.adb index a6a61a432ea..32604bdbca6 100644 --- a/gcc/ada/g-dyntab.adb +++ b/gcc/ada/g-dyntab.adb @@ -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 diff --git a/gcc/ada/g-table.adb b/gcc/ada/g-table.adb index 2fd5d320034..32d18a08b74 100644 --- a/gcc/ada/g-table.adb +++ b/gcc/ada/g-table.adb @@ -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 diff --git a/gcc/ada/table.adb b/gcc/ada/table.adb index 273be819e2e..db64c4cf956 100644 --- a/gcc/ada/table.adb +++ b/gcc/ada/table.adb @@ -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 |