diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-04-05 20:34:43 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2023-09-27 10:16:26 +0200 |
commit | 34a2d742bfbec548058ed3a25d3e35ec180eb7c4 (patch) | |
tree | 5170957ed6c13e86b72bb866bbbc0bcbf8b0c2ef /gcc | |
parent | 30b3c57434423ac7d89d70b80b579ba8809a7626 (diff) | |
download | gcc-34a2d742bfbec548058ed3a25d3e35ec180eb7c4.zip gcc-34a2d742bfbec548058ed3a25d3e35ec180eb7c4.tar.gz gcc-34a2d742bfbec548058ed3a25d3e35ec180eb7c4.tar.bz2 |
ada: Fix wrong result for membership test of null in null-excluding access type
The result must be False as per the RM 4.5.2 (30.2/4) clause.
gcc/ada/
* exp_ch4.adb (Expand_N_In): Deal specifically with a null operand.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/exp_ch4.adb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 0490a31..8442de6 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -6964,11 +6964,13 @@ package body Exp_Ch4 is -- If the null exclusion checks are not compatible, need to -- perform further checks. In other words, we cannot have - -- Ltyp including null and Typ excluding null. All other cases - -- are OK. + -- Ltyp including null or Lop being null, and Typ excluding + -- null. All other cases are OK. Check_Null_Exclusion := - Can_Never_Be_Null (Typ) and then not Can_Never_Be_Null (Ltyp); + Can_Never_Be_Null (Typ) + and then (not Can_Never_Be_Null (Ltyp) + or else Nkind (Lop) = N_Null); Typ := Designated_Type (Typ); end if; |