diff options
author | Marc Poulhiès <poulhies@adacore.com> | 2022-11-07 14:34:54 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2022-11-21 11:10:31 +0100 |
commit | 493e760dda4dac45eefac4185a7b04a1b8fc6c18 (patch) | |
tree | a3425805f144661ec631250980e69844009767a6 /libcpp | |
parent | 6d0d71ea1c685df245f3c11a5daf52843823cd58 (diff) | |
download | gcc-493e760dda4dac45eefac4185a7b04a1b8fc6c18.zip gcc-493e760dda4dac45eefac4185a7b04a1b8fc6c18.tar.gz gcc-493e760dda4dac45eefac4185a7b04a1b8fc6c18.tar.bz2 |
ada: Reject nonconfirming Size attribute value for aliased object
Only confirming Size must be supported for aliased object of elementary
type (see RM 13.1 in the "Implementation Advice").
-- size is 1-byte
type Y is range 0 .. 20;
type Ay is access all Y;
-- Var size is 8-bytes
Var : aliased Y := 5 with Size => 64;
-- JP.all is a 1-byte reference to an 8-bytes objects.
JP : Ay := Var'Access;
The above JP.all references the first byte of the 8-byte Var object,
which is, for example, not correct on little-endian systems.
This change rejects nonconfirming Size attribute on such objects
instead of miscompiling it.
gcc/ada/
* sem_ch13.adb (Check_One_Attr): produce error when Size attribute
used on aliased object of elementary types with nonconfirming
value.
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions