diff options
author | Bob Duff <duff@adacore.com> | 2021-07-05 18:01:22 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-09-21 15:24:59 +0000 |
commit | b12d18a82597b97cbaccbac4253e8837f339d9a0 (patch) | |
tree | 0ebb150fd5c953a4fc9dd1c8baa9d6a4d13a5027 /gcc/ada/freeze.adb | |
parent | 97a5ed2071fffe85ee1a07e0655740162e4cce64 (diff) | |
download | gcc-b12d18a82597b97cbaccbac4253e8837f339d9a0.zip gcc-b12d18a82597b97cbaccbac4253e8837f339d9a0.tar.gz gcc-b12d18a82597b97cbaccbac4253e8837f339d9a0.tar.bz2 |
[Ada] Add assertions to Uintp
gcc/ada/
* uintp.ads, uintp.adb: Add assertions.
(Ubool, Opt_Ubool): New "boolean" subtypes.
(UI_Is_In_Int_Range): The parameter should probably be
Valid_Uint, but we don't change that for now, because it causes
failures in gigi.
* sem_util.ads, sem_util.adb (Is_True, Is_False,
Static_Boolean): Use Opt_Ubool subtype. Document the fact that
Is_True (No_Uint) = True. Implement Is_False in terms of
Is_True. We considered changing Static_Boolean to return Uint_1
in case of error, but that doesn't fit in well with
Static_Integer.
(Has_Compatible_Alignment_Internal): Deal with cases where Offs
is No_Uint. Change one "and" to "and then" to ensure we don't
pass No_Uint to ">", which would violate the new assertions.
* exp_util.adb, freeze.adb, sem_ch13.adb: Avoid violating new
assertions in Uintp.
Diffstat (limited to 'gcc/ada/freeze.adb')
-rw-r--r-- | gcc/ada/freeze.adb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index c3c4f53..15ce832 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -1268,9 +1268,13 @@ package body Freeze is if Present (Component_Clause (Comp)) then Comp_Byte_Aligned := - (Normalized_First_Bit (Comp) mod System_Storage_Unit = 0) + Known_Normalized_First_Bit (Comp) and then - (Esize (Comp) mod System_Storage_Unit = 0); + Known_Esize (Comp) + and then + Normalized_First_Bit (Comp) mod System_Storage_Unit = 0 + and then + Esize (Comp) mod System_Storage_Unit = 0; else Comp_Byte_Aligned := not Is_Packed (Encl_Type); end if; |