]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Add size clause to System.Address
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 8 Mar 2023 17:11:31 +0000 (18:11 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 25 May 2023 07:44:18 +0000 (09:44 +0200)
Standard'Address_Size is the value provided by the code generator for the
size of pointers, and it is set as the default size of every thin pointer
by the front-end.  Now it is documented in the GNAT RM as having the value
of System.Address'Size, which is indeed the case on (correctly configured)
platforms where pointers contain exactly the number of bits that are needed
to address the memory space.

However, on platforms where pointers contain additional bits of metadata,
it has a larger value and the documented relation does not hold, which also
means that unchecked conversions between System.Address and pointers are
seen as potentially problematic.  In order to fix the discrepancy on these
platforms, this change adds the obvious size clause to System.Address, which
is confirming on all the other (correctly configured) platforms.

gcc/ada/

* libgnat/system-aix.ads (Address): Likewise.
* libgnat/system-darwin-arm.ads (Address): Likewise.
* libgnat/system-darwin-ppc.ads (Address): Likewise.
* libgnat/system-darwin-x86.ads (Address): Likewise.
* libgnat/system-djgpp.ads (Address): Likewise.
* libgnat/system-dragonfly-x86_64.ads (Address): Likewise.
* libgnat/system-freebsd.ads (Address): Likewise.
* libgnat/system-hpux-ia64.ads (Address): Likewise.
* libgnat/system-hpux.ads (Address): Likewise.
* libgnat/system-linux-alpha.ads (Address): Likewise.
* libgnat/system-linux-arm.ads (Address): Likewise.
* libgnat/system-linux-hppa.ads (Address): Likewise.
* libgnat/system-linux-ia64.ads (Address): Likewise.
* libgnat/system-linux-m68k.ads (Address): Likewise.
* libgnat/system-linux-mips.ads (Address): Likewise.
* libgnat/system-linux-ppc.ads (Address): Likewise.
* libgnat/system-linux-riscv.ads (Address): Likewise.
* libgnat/system-linux-s390.ads (Address): Likewise.
* libgnat/system-linux-sh4.ads (Address): Likewise.
* libgnat/system-linux-sparc.ads (Address): Likewise.
* libgnat/system-linux-x86.ads (Address): Likewise.
* libgnat/system-lynxos178-ppc.ads (Address): Likewise.
* libgnat/system-lynxos178-x86.ads (Address): Likewise.
* libgnat/system-mingw.ads (Address): Likewise.
* libgnat/system-qnx-arm.ads (Address): Likewise.
* libgnat/system-rtems.ads (Address): Likewise.
* libgnat/system-solaris-sparc.ads (Address): Likewise.
* libgnat/system-solaris-x86.ads (Address): Likewise.
* libgnat/system-vxworks-ppc-kernel.ads (Address): Likewise.
* libgnat/system-vxworks-ppc-rtp-smp.ads (Address): Likewise.
* libgnat/system-vxworks-ppc-rtp.ads (Address): Likewise.
* libgnat/system-vxworks7-aarch64-rtp-smp.ads (Address): Likewise.
* libgnat/system-vxworks7-aarch64.ads (Address): Likewise.
* libgnat/system-vxworks7-arm-rtp-smp.ads (Address): Likewise.
* libgnat/system-vxworks7-arm.ads (Address): Likewise.
* libgnat/system-vxworks7-ppc-kernel.ads (Address): Likewise.
* libgnat/system-vxworks7-ppc-rtp-smp.ads (Address): Likewise.
* libgnat/system-vxworks7-ppc64-kernel.ads (Address): Likewise.
* libgnat/system-vxworks7-ppc64-rtp-smp.ads (Address): Likewise.
* libgnat/system-vxworks7-x86-kernel.ads (Address): Likewise.
* libgnat/system-vxworks7-x86-rtp-smp.ads (Address): Likewise.
* libgnat/system-vxworks7-x86_64-kernel.ads (Address): Likewise.
* libgnat/system-vxworks7-x86_64-rtp-smp.ads (Address): Likewise.

43 files changed:
gcc/ada/libgnat/system-aix.ads
gcc/ada/libgnat/system-darwin-arm.ads
gcc/ada/libgnat/system-darwin-ppc.ads
gcc/ada/libgnat/system-darwin-x86.ads
gcc/ada/libgnat/system-djgpp.ads
gcc/ada/libgnat/system-dragonfly-x86_64.ads
gcc/ada/libgnat/system-freebsd.ads
gcc/ada/libgnat/system-hpux-ia64.ads
gcc/ada/libgnat/system-hpux.ads
gcc/ada/libgnat/system-linux-alpha.ads
gcc/ada/libgnat/system-linux-arm.ads
gcc/ada/libgnat/system-linux-hppa.ads
gcc/ada/libgnat/system-linux-ia64.ads
gcc/ada/libgnat/system-linux-m68k.ads
gcc/ada/libgnat/system-linux-mips.ads
gcc/ada/libgnat/system-linux-ppc.ads
gcc/ada/libgnat/system-linux-riscv.ads
gcc/ada/libgnat/system-linux-s390.ads
gcc/ada/libgnat/system-linux-sh4.ads
gcc/ada/libgnat/system-linux-sparc.ads
gcc/ada/libgnat/system-linux-x86.ads
gcc/ada/libgnat/system-lynxos178-ppc.ads
gcc/ada/libgnat/system-lynxos178-x86.ads
gcc/ada/libgnat/system-mingw.ads
gcc/ada/libgnat/system-qnx-arm.ads
gcc/ada/libgnat/system-rtems.ads
gcc/ada/libgnat/system-solaris-sparc.ads
gcc/ada/libgnat/system-solaris-x86.ads
gcc/ada/libgnat/system-vxworks-ppc-kernel.ads
gcc/ada/libgnat/system-vxworks-ppc-rtp-smp.ads
gcc/ada/libgnat/system-vxworks-ppc-rtp.ads
gcc/ada/libgnat/system-vxworks7-aarch64-rtp-smp.ads
gcc/ada/libgnat/system-vxworks7-aarch64.ads
gcc/ada/libgnat/system-vxworks7-arm-rtp-smp.ads
gcc/ada/libgnat/system-vxworks7-arm.ads
gcc/ada/libgnat/system-vxworks7-ppc-kernel.ads
gcc/ada/libgnat/system-vxworks7-ppc-rtp-smp.ads
gcc/ada/libgnat/system-vxworks7-ppc64-kernel.ads
gcc/ada/libgnat/system-vxworks7-ppc64-rtp-smp.ads
gcc/ada/libgnat/system-vxworks7-x86-kernel.ads
gcc/ada/libgnat/system-vxworks7-x86-rtp-smp.ads
gcc/ada/libgnat/system-vxworks7-x86_64-kernel.ads
gcc/ada/libgnat/system-vxworks7-x86_64-rtp-smp.ads

index 18ed063e2e39b6556f378932975d7a54649a227e..1485df42a45467aabb0a58ae94fca1618656275a 100644 (file)
@@ -116,6 +116,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 4e4603b739a266b4404248ddf90bbf0e6255a504..a57bf0b63ea454db4be1e4631ea156db11052611 100644 (file)
@@ -132,6 +132,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 80c28c5a78560efdebc97ee3f04de565abc9cdb9..b6e73fd21043b0d3e260abb2898cb20ef3d251a7 100644 (file)
@@ -132,6 +132,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index dc52576fae2912428e7c9dd57ad085d04fd9862e..994b22f3b193a7efd1621431d198e4a02fcb6698 100644 (file)
@@ -132,6 +132,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 2addbfee0c0abf685de5cd60573218eea5fc0c7a..459475e7eabc321468831bbd0c196fded5097850 100644 (file)
@@ -106,6 +106,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 0e8e0ee53bc48ebd8a1084bdc86079cb703dd5a4..6b16156850c12f0d383760b08c3ac489cfbf8b07 100644 (file)
@@ -106,6 +106,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 23bb9a7f29979b0fdbdc1c850fa15560e97338cb..32c1cc4324d0127d986e00a2e55b519af7733509 100644 (file)
@@ -107,6 +107,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 991ff9e06396a51117f3ef0155b237008702e3b7..8eb4a8f8de4d3b6bcd887498dcba0bb767dbc620 100644 (file)
@@ -106,6 +106,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 30e029367e8bd80b1e77eaa19089fc9f9e4e9487..4c5eb3e56e68e5b8fc973107da6cdc731bafe252 100644 (file)
@@ -106,6 +106,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 021a9aa878d1b1ecf0836dc083b7dc5c40916ee0..86fcea3227258eff97195af79bd35fb630e6ac13 100644 (file)
@@ -106,6 +106,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 0c942449231137e373c4b009a47adf49a4dc36f4..724086ca84744a24e8f6d9a0ccc023e345c2c85d 100644 (file)
@@ -115,6 +115,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 41a8d3f6d42f3473efde3058f792dbec5b00516d..148b6f02c483e733b1ff15438e77c1d5c1d6f79d 100644 (file)
@@ -106,6 +106,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index a788eb2fb0740cc84503679e4bcbe9f8a7359e14..d33282031e56588469579b3c937db9f010a906c7 100644 (file)
@@ -114,6 +114,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 669428b4175ae91fa111e080597a8661a5ef90e8..9db322b38141a59110fcd846eb1c04386f0e2ab0 100644 (file)
@@ -116,6 +116,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index a40a0d276010acd54934700f43eca17cd4685626..929e54b55a0000991901789d8ef6b382c706d2b7 100644 (file)
@@ -107,6 +107,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index f5bb80187f184a6aef15814a9103e8d002237c37..1358bf9095365a9df0e0d093bbe4fe45b7ba1685 100644 (file)
@@ -115,6 +115,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 8f8f6e65fc27ab6750498f31000d372fc750ed0b..420a5025e9091a17cc266f61d122dd0d3c861446 100644 (file)
@@ -106,6 +106,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index dee24244ddba95feefbeae42ec13f3770699d4bc..f53c43ff193f0171ff2b5b2aafd3ab184c972c46 100644 (file)
@@ -106,6 +106,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 52c67b653a63e8d58fb53dea69d2d5156331cb96..4970b28d8466b836cb2152f5998df064c5ba15ca 100644 (file)
@@ -114,6 +114,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 4b4978b0774e2751b022cbefdb1d4cb2193d4cc4..a319664368554ff49756232b7a63f46fb1dcd13b 100644 (file)
@@ -106,6 +106,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index ec17297b0baaf8730a465ba732c75bf769751178..85538d671d0606847a5cef4d9fdcf3b77375679c 100644 (file)
@@ -114,6 +114,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 75f17b211b184bd93e6200bc3b63dd8d319815d6..a0ef41187e89cf9e02065ead10c3041ca401bf67 100644 (file)
@@ -121,6 +121,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 0f4caea11b9aee29cdc59d8d304bbddf1adb5909..8c8a61e638a5cea0802d24ef0f94dc6f41232ebc 100644 (file)
@@ -121,6 +121,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index af1cb208a48598f90a099bc00582feb1ae75a891..4b5a7ce0722ba3f89852750c86e3d3a5a23beafa 100644 (file)
@@ -106,6 +106,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index e8343998e14b43ba3dce5142a5856651bf854049..344bd6168f350895201ee7998d990ba6fff09c28 100644 (file)
@@ -115,6 +115,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 6518ada80ffe750af1055f571db3de07d80dbd62..2dc2d812ff17b5b04862b29fe2ef8a59d45c1738 100644 (file)
@@ -123,6 +123,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index e667cd5c5ea765ec52c94a2ccf94ff8b4acc365a..7bd8460511382a7cce2ea1a5f435cbdb83eb88e2 100644 (file)
@@ -106,6 +106,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index b1a27336bf21b7df0705e3773553da6ea0051d1e..60776682a647d1a4f32060bb6ece335482d9768b 100644 (file)
@@ -106,6 +106,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index e57b1953dee921045c1eae7a1c6bb134316d065a..f12dc6e8507362686828e5e290705e9edf857e58 100644 (file)
@@ -119,6 +119,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index ff7c0e6b8f55686149317756f8e842c89f3c264c..d8c498fac7febe0e744b5b9ca92a9f3cbeae0845 100644 (file)
@@ -125,6 +125,8 @@ private
    --  Setup proper set of -L's for this configuration
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index deb7f5fd3717abdbdee443963f10fa92b9432abb..3a3d33694c898976cbcb68f7e3e94a7dfc05e6e2 100644 (file)
@@ -124,6 +124,8 @@ private
    --  Setup proper set of -L's for this configuration
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 3df8b7b5723a1228dd7fee5798ac0646390f6fb6..0a7886b0d25f196ccf5cd7c84ff3439e783171f3 100644 (file)
@@ -124,6 +124,8 @@ private
    --  Define the symbol wrs_rtp_base
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 103e9497d5b675d9b864474ef2a2ef52468c2ee1..811fac1bdc9e19441621dce8173d860878c4460d 100644 (file)
@@ -121,6 +121,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index fae23b1c6ae3d3be0f514b5634dc3912ab2adcfc..abdc2006d1155fe47eb1f5b9e01133601db83b6b 100644 (file)
@@ -121,6 +121,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 2fa7ed811f0dc418e95d8ad4b366683e7b77a2ba..0e5e3e647f253840dcc031bef6ab56164ee18516 100644 (file)
@@ -119,6 +119,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index ed250e5a416d5c66439df63ab9c88639fbd30e21..573abe7aa990feb2c264299990b73cf6569084b6 100644 (file)
@@ -119,6 +119,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 503c32683150f8a048abd146012e92ed4bfffc7f..cc25943f06382b7392f0cd63ed50b17fdaf777d2 100644 (file)
@@ -124,6 +124,8 @@ private
    --  Define the symbol wrs_rtp_base
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 1d5d5920c579132a16f24448aa49f4f67ed6b66f..f4f1af5d65236cfa4d909b7f61904cdb69de6e83 100644 (file)
@@ -121,6 +121,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index b55f28939e594c39ceee6f46ec9b929af0f0da8f..4868891bb4101baa520a14a170490953b278353c 100644 (file)
@@ -124,6 +124,8 @@ private
    --  Define the symbol wrs_rtp_base
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 471009827f1352df7fcffb971a82fb1ec211ea5b..e60e1220d32d9fcdd3c003aa18a4ef812ba365ac 100644 (file)
@@ -119,6 +119,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 867e39f061fd83d82a8d7c177d1468e716f655be..b8a25a3cb53f9484e7d4740ca2963ba32887ad9d 100644 (file)
@@ -122,6 +122,8 @@ private
    --  Define the symbol wrs_rtp_base
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index dc00937b8e375f32059799e13e3eb51ef407b080..273529f954ca4335413dc02bb6eec9797d096925 100644 (file)
@@ -119,6 +119,8 @@ package System is
 private
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------
index 501ee72776368a6c3d985b3b0dd2785df7988f64..a2ea30a8ed612594e8735c10a4318388595d4055 100644 (file)
@@ -122,6 +122,8 @@ private
    --  Define the symbol wrs_rtp_base
 
    type Address is mod Memory_Size;
+   for Address'Size use Standard'Address_Size;
+
    Null_Address : constant Address := 0;
 
    --------------------------------------