aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSebastian Poeplau <poeplau@adacore.com>2024-03-20 11:48:22 +0100
committerMarc Poulhiès <poulhies@adacore.com>2024-05-20 09:47:03 +0200
commit16cdeadb33400238ea522541009ecd2a24769f0c (patch)
treec2edba69d8a17767f004b69a61cf82faf015c473 /gcc
parentcaaf20e2678117861a7a4d1da712be91a94596b1 (diff)
downloadgcc-16cdeadb33400238ea522541009ecd2a24769f0c.zip
gcc-16cdeadb33400238ea522541009ecd2a24769f0c.tar.gz
gcc-16cdeadb33400238ea522541009ecd2a24769f0c.tar.bz2
ada: Use System.Address for address computation in System.Pool_Global
Some architectures don't let us convert System.Storage_Elements.Integer_Address back to a valid System.Address. Using the arithmetic operations on System.Address from System.Storage_Elements prevents the problem while leaving semantics unchanged. gcc/ada/ * libgnat/s-pooglo.adb (Allocate): Use arithmetic on System.Address to compute the aligned address.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/libgnat/s-pooglo.adb7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/ada/libgnat/s-pooglo.adb b/gcc/ada/libgnat/s-pooglo.adb
index dea3de1..9ce21c8 100644
--- a/gcc/ada/libgnat/s-pooglo.adb
+++ b/gcc/ada/libgnat/s-pooglo.adb
@@ -75,9 +75,10 @@ package body System.Pool_Global is
-- Realign the returned address
- Aligned_Address := To_Address
- (To_Integer (Allocated) + Integer_Address (Alignment)
- - (To_Integer (Allocated) mod Integer_Address (Alignment)));
+ Aligned_Address :=
+ Allocated + Alignment
+ - Storage_Offset (To_Integer (Allocated)
+ mod Integer_Address (Alignment));
-- Save the block address