From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 347C438708F9; Thu, 17 Dec 2020 10:51:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 347C438708F9 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-6216] [Ada] Prevent early exits without restoring a global variable X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: 445032728dd46e3692a9aed879c6cf350259a53a X-Git-Newrev: 96c1f71463d067012241179df71c5872cec7a765 Message-Id: <20201217105142.347C438708F9@sourceware.org> Date: Thu, 17 Dec 2020 10:51:42 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Dec 2020 10:51:42 -0000 https://gcc.gnu.org/g:96c1f71463d067012241179df71c5872cec7a765 commit r11-6216-g96c1f71463d067012241179df71c5872cec7a765 Author: Piotr Trojanek Date: Tue Dec 1 15:17:27 2020 +0100 [Ada] Prevent early exits without restoring a global variable gcc/ada/ * sem_ch5.adb (Analyze_Case_Statement): Move modification of Unblocked_Exit_Count after early return statements; fix typo in comment. Diff: --- gcc/ada/sem_ch5.adb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 380d6017414..04fc9806c58 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -1494,7 +1494,6 @@ package body Sem_Ch5 is -- Start of processing for Analyze_Case_Statement begin - Unblocked_Exit_Count := 0; Analyze (Exp); -- The expression must be of any discrete type. In rare cases, the @@ -1558,7 +1557,9 @@ package body Sem_Ch5 is Exp_Type := Exp_Btype; end if; - -- Call instantiated procedures to analyzwe and check discrete choices + -- Call instantiated procedures to analyze and check discrete choices + + Unblocked_Exit_Count := 0; Analyze_Choices (Alternatives (N), Exp_Type); Check_Choices (N, Alternatives (N), Exp_Type, Others_Present);