From patchwork Mon May 29 08:29:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 70226 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1CF693882AC2 for ; Mon, 29 May 2023 08:35:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1CF693882AC2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685349351; bh=n4oGHM1Zr0fnZIVA2h6NZcJgWcAq8nYUZDuwXBBSUrs=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=J3b1tqENitLW4UiDIU/gUzTuV7wPLFX1D+2o/KuZ5xqZ6A//4EPp/igzZtJprE68c Kd5C80OjPOUm0nw0NvO5iDLxauBLEtzplfufktNPC7gqWgfMT9MyBG46H3NrSRg+Xj ueERpEl6Ah4SR9BWyL/+EypMjT2wx+z8/wh49J/U= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id E37E8384DA6C for ; Mon, 29 May 2023 08:29:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E37E8384DA6C Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3f68fc6b479so31153545e9.2 for ; Mon, 29 May 2023 01:29:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685348971; x=1687940971; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=n4oGHM1Zr0fnZIVA2h6NZcJgWcAq8nYUZDuwXBBSUrs=; b=ILPEpMQKlArg2UJZTlHRn6WmWHSr5h/j9T6v2j5oSnmC7f7HmaZYU6h9qAjE7r5i8/ hb9j+E0YNMJjsXuv+gW0apSUpYf/eDBIxxvBIRipqZvgFcg6EnP/aoL5/x5jEh1DA+1Z hf++owcwWzqL75898nwg/nIjYUN9SRWQoBWDhj5ZwrEnlX7S71fGDUKiAQ/pe6BScuwG GJDud/QccGEvkihALxW2Zzdd0B+PuzN0SEK5bbNd/7LCMApYD9N7Qpw9LJ+P5jdqJCoV NuBDZo3D8no1IQwVy89YTI0fZOv4WXMreNlELXsOYzD2g0vDGnkXIxuqdJO8bd7hypcO jknQ== X-Gm-Message-State: AC+VfDzhNV9ry0MP6li4Z4ubVILKemV2akdsBsnfiZeUzd1S9m9in/k4 RKk2364DN8yIeJ3AksHYoqXNLnEh0hRBMgbbru7KzQ== X-Google-Smtp-Source: ACHHUZ6LaM5T+ZdIP0reUKwpcypomG8N5A7AViuq5g6h1bceO7oXTao1of/LTm/dm6pjvBWMAh7GjQ== X-Received: by 2002:a7b:c84c:0:b0:3f4:2374:3512 with SMTP id c12-20020a7bc84c000000b003f423743512mr8595223wml.18.1685348970830; Mon, 29 May 2023 01:29:30 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id z22-20020a7bc7d6000000b003f4fbd9cdb3sm13392816wmk.34.2023.05.29.01.29.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 01:29:30 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix wrong result for membership test of null in null-excluding access type Date: Mon, 29 May 2023 10:29:29 +0200 Message-Id: <20230529082929.2410336-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Eric Botcazou 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. Tested on x86_64-pc-linux-gnu, committed on master. --- 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 3f864f2675c..537d7a6311c 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -6972,11 +6972,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;