[Ada] Prevent early exits without restoring a global variable

Pierre-Marie de Rodat derodat@adacore.com
Thu Dec 17 10:50:08 GMT 2020


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 769 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201217/897f27bf/attachment-0001.bin>


More information about the Gcc-patches mailing list