aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnat
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2020-11-02 12:27:55 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2020-11-30 09:16:21 -0500
commitb60170728ea74dd615f32a7da11e8291c935ab66 (patch)
treef9ded79bb4bb16e6ac45e9f050cbde3d74b2397b /gcc/ada/libgnat
parent19b95c22c0fb9d301cac839936e8348b857ee550 (diff)
downloadgcc-b60170728ea74dd615f32a7da11e8291c935ab66.zip
gcc-b60170728ea74dd615f32a7da11e8291c935ab66.tar.gz
gcc-b60170728ea74dd615f32a7da11e8291c935ab66.tar.bz2
[Ada] Enable checks on runtime by default
gcc/ada/ * gcc-interface/Makefile.in (GNATLIBFLAGS): Enable checks by default. * libgnat/s-bitfie.ads: Suppress alignment checks. * libgnat/s-bituti.adb: Minor reformatting. * libgnat/s-secsta.adb (SS_Allocate): Support Size = 0.
Diffstat (limited to 'gcc/ada/libgnat')
-rw-r--r--gcc/ada/libgnat/s-bitfie.ads6
-rw-r--r--gcc/ada/libgnat/s-bituti.adb1
-rw-r--r--gcc/ada/libgnat/s-secsta.adb15
3 files changed, 16 insertions, 6 deletions
diff --git a/gcc/ada/libgnat/s-bitfie.ads b/gcc/ada/libgnat/s-bitfie.ads
index 4f17a9c..21b7294 100644
--- a/gcc/ada/libgnat/s-bitfie.ads
+++ b/gcc/ada/libgnat/s-bitfie.ads
@@ -47,6 +47,12 @@ package System.Bitfields is
pragma Provide_Shift_Operators (Val_2);
type Val is mod 2**Val_Bits with Alignment => Val_Bytes;
+ -- ??? It turns out that enabling checks on the instantiation of
+ -- System.Bitfield_Utils.G makes a latent visibility bug appear on strict
+ -- alignment platforms related to alignment checks. Work around it by
+ -- suppressing these checks explicitly.
+
+ pragma Suppress (Alignment_Check);
package Utils is new System.Bitfield_Utils.G (Val, Val_2);
procedure Copy_Bitfield
diff --git a/gcc/ada/libgnat/s-bituti.adb b/gcc/ada/libgnat/s-bituti.adb
index e3bd70a..ef839a8 100644
--- a/gcc/ada/libgnat/s-bituti.adb
+++ b/gcc/ada/libgnat/s-bituti.adb
@@ -317,6 +317,7 @@ package body System.Bitfield_Utils is
Get_Val_2 (S_Addr, S_Off, Initial_Size);
Initial_Val : constant Val :=
Get_Bitfield (Initial_Val_2, S_Off, Initial_Size);
+
begin
Set_Bitfield
(Initial_Val, D_Addr, D_Off, Initial_Size);
diff --git a/gcc/ada/libgnat/s-secsta.adb b/gcc/ada/libgnat/s-secsta.adb
index 7ec8462..f2d264d 100644
--- a/gcc/ada/libgnat/s-secsta.adb
+++ b/gcc/ada/libgnat/s-secsta.adb
@@ -587,15 +587,18 @@ package body System.Secondary_Stack is
-- Start of processing for SS_Allocate
begin
- -- It should not be possible to request an allocation of negative or
- -- zero size.
-
- pragma Assert (Storage_Size > 0);
-
-- Round the requested size up to the nearest multiple of the maximum
-- alignment to ensure efficient access.
- Mem_Size := Round_Up (Storage_Size);
+ if Storage_Size = 0 then
+ Mem_Size := Memory_Alignment;
+ else
+ -- It should not be possible to request an allocation of negative
+ -- size.
+
+ pragma Assert (Storage_Size >= 0);
+ Mem_Size := Round_Up (Storage_Size);
+ end if;
if Sec_Stack_Dynamic then
Allocate_Dynamic (Stack, Mem_Size, Addr);