aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-12-01 15:17:27 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2020-12-17 05:49:24 -0500
commit96c1f71463d067012241179df71c5872cec7a765 (patch)
tree2760394089ca07beda5292d3ac6bb04897371553 /gcc
parent445032728dd46e3692a9aed879c6cf350259a53a (diff)
downloadgcc-96c1f71463d067012241179df71c5872cec7a765.zip
gcc-96c1f71463d067012241179df71c5872cec7a765.tar.gz
gcc-96c1f71463d067012241179df71c5872cec7a765.tar.bz2
[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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch5.adb5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 380d601..04fc980 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);