From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 3C4F93861877 for ; Tue, 26 Sep 2023 11:46:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3C4F93861877 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-405361bba99so82107965e9.2 for ; Tue, 26 Sep 2023 04:46:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1695728778; x=1696333578; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=C1GBkpfEzZWBafAIpJD5ydd3cBUJ2r+7dT5uM2f4rDU=; b=hOpY6Pcv5t3Xi205TWrYM12T+xYoVsFXhPK+FYKSJcrqCUFu5ab5RiUkO5a8iUPFyK lFXYPOrJK4JkrcuRw+d8glJK4Lr+71x6anV1oEiVv/VPKIS4G0L9o7uRBuN6lPFENAd1 M1oa8C1mC5oH0uFsUBrM5oPrhLl6ovtYMgi9rv38EYCneg1B5rGbmBYIFAnADIAcx81I uVbLCvynymLpKKXBl7OwD6gjAnDpP7BmvnMNA4rBI/V5dBsa/QRKd7z2St6B6NgeEZlI qiTyqTlRGfMypCnX/m5FpyHhSG7rECqEwFeWdJxKIUxxP3R359BQpepWL/OpDQQF29GO ja9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695728778; x=1696333578; 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=C1GBkpfEzZWBafAIpJD5ydd3cBUJ2r+7dT5uM2f4rDU=; b=Lv4cnPDQE0/05dFrRB7sZz/LT5XF5YLS+xIvGvZCxAid8K0AFs0wnwjhJ7advA+xCi 4dVmJPKc9+P4jNyxQ3HJm2Dze6UgHD7HlFMWaMIztbJF7/BOXd67YdM65D8vkwWfx9ZE 6lH4yBAPr7s4RiM3LaBFo9D7GUc5OC+LqS4gp6lU6h0iHNld4lN1iISjBlIIydg1cW40 7eu1AckXr+5FGnY0oOK7z1w7T6s4R1xkRqeT17ggmmnvJo1rbtI5MCjLyiXoPJlepMna kwSTHH1nIUUemeNaIF0vZKtKFNOPsWbTd1m/SaOELJFBMdalTBq0Qtm/wkQbkx3Sj97U dJVQ== X-Gm-Message-State: AOJu0YzK6zDcuwwIqhYHa1i1WXXuMFHpdV4nbhuxcZtPe1uXkyvplBhc OevGkUCqvgrskUOa276IfV0k6UaB2fu/G69Ap0gufw== X-Google-Smtp-Source: AGHT+IEX5XsP9NlgkEgXrxOjRUYfuMp8ceHIN/o1lyXTAtYjHDUezIFRTljxMB673CUGu60TcNS6bQ== X-Received: by 2002:a05:600c:2187:b0:3fe:5053:1a0b with SMTP id e7-20020a05600c218700b003fe50531a0bmr8008346wme.11.1695728777633; Tue, 26 Sep 2023 04:46:17 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:27f0:a2f3:f97:f30e]) by smtp.gmail.com with ESMTPSA id 12-20020a05600c25cc00b003fe1c332810sm323236wml.33.2023.09.26.04.46.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 04:46:17 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Yannick Moy Subject: [COMMITTED] ada: Clarify RM references that justify a constraint check Date: Tue, 26 Sep 2023 13:46:07 +0200 Message-ID: <20230926114608.3272229-1-poulhies@adacore.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Yannick Moy gcc/ada/ * exp_ch5.adb (Expand_N_Case_Statement): Reference both sections of the Ada RM that deal with case statements and case expressions to justify the insertion of a runtime check. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch5.adb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index d55fdb3e2e5..cd3b02b9360 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -4092,8 +4092,9 @@ package body Exp_Ch5 is end if; -- First step is to worry about possible invalid argument. The RM - -- requires (RM 5.4(13)) that if the result is invalid (e.g. it is - -- outside the base range), then Constraint_Error must be raised. + -- requires (RM 4.5.7 (21/3) and 5.4 (13)) that if the result is + -- invalid (e.g. it is outside the base range), then Constraint_Error + -- must be raised. -- Case of validity check required (validity checks are on, the -- expression is not known to be valid, and the case statement @@ -4274,7 +4275,7 @@ package body Exp_Ch5 is -- If Predicates_Ignored is true the value does not satisfy the -- predicate, and there is no Others choice, Constraint_Error - -- must be raised (4.5.7 (21/3)). + -- must be raised (RM 4.5.7 (21/3) and 5.4 (13)). if Predicates_Ignored (Etype (Expr)) then declare -- 2.42.0