]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Use System.Address for address computation in System.Pool_Global
authorSebastian Poeplau <poeplau@adacore.com>
Wed, 20 Mar 2024 10:48:22 +0000 (11:48 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 20 May 2024 07:47:03 +0000 (09:47 +0200)
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.

gcc/ada/libgnat/s-pooglo.adb

index dea3de15cc518c354fbf658020ba7dc4f0a7612a..9ce21c8fd0daaa6e1f325d9bbef01ddee05edf3a 100644 (file)
@@ -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