In Analyze_Case_Statement we save the current value of
Unblocked_Exit_Count with the intention to restore it on exit. However,
when returning early due to errors we failed to restore the previous
value. It seems cleaner to only modify this variable after the possible
early exits.
Mainly just a cleanup; behaviour on a valid code is unaffected.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_ch5.adb (Analyze_Case_Statement): Move modification of
Unblocked_Exit_Count after early return statements; fix typo in
comment.
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
--- 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);