From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id 0315D3858D35; Tue, 26 Sep 2023 11:45:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0315D3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695728726; bh=eHn2nTxz8vrG6OUSjzwrOTud7v1hHu1lnICb2scgT4A=; h=From:To:Subject:Date:From; b=kZE8WCAXWu5iM5jYO0qAA3iClk4DSEpkgwhLuIETCfcBF+lSMyCLU8HgNqLthDCsS vtS4QBXWUIs3SY7ymnhtAtzfS2Ybzky21D5Xon67DM1rn9sbcYarlCJH5oeZCG7qLB Zp0URt4uAb/OEWVktB2e8tJZ9pkSvSRxBIzgU0oc= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-4265] ada: Clarify RM references that justify a constraint check X-Act-Checkin: gcc X-Git-Author: Yannick Moy X-Git-Refname: refs/heads/master X-Git-Oldrev: d324984f9fa50e0055e3818f29d8c019df08cecf X-Git-Newrev: 92361698288fd3192655f409f603b88b0aa182b8 Message-Id: <20230926114526.0315D3858D35@sourceware.org> Date: Tue, 26 Sep 2023 11:45:26 +0000 (GMT) List-Id: https://gcc.gnu.org/g:92361698288fd3192655f409f603b88b0aa182b8 commit r14-4265-g92361698288fd3192655f409f603b88b0aa182b8 Author: Yannick Moy Date: Tue Sep 12 09:54:32 2023 +0200 ada: Clarify RM references that justify a constraint check 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. Diff: --- 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