public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-7870] ada: Fix wrong result for membership test of null in null-excluding access type
@ 2023-09-27 8:25 Eric Botcazou
0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2023-09-27 8:25 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:34a2d742bfbec548058ed3a25d3e35ec180eb7c4
commit r13-7870-g34a2d742bfbec548058ed3a25d3e35ec180eb7c4
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Wed Apr 5 20:34:43 2023 +0200
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.
Diff:
---
gcc/ada/exp_ch4.adb | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 0490a31a720..8442de6f90c 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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-27 8:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-27 8:25 [gcc r13-7870] ada: Fix wrong result for membership test of null in null-excluding access type Eric Botcazou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).