]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Reject conditional goto in lock-free protected subprograms
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 3 Oct 2022 14:49:19 +0000 (16:49 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 6 Oct 2022 09:22:49 +0000 (11:22 +0200)
In lock-free protected subprograms we don't allow goto statements;
likewise, we now reject conditional goto statements.

This fix only affects semantic checking mode with switch -gnatc.
In ordinary compilation we already rejected conditional goto after
it was expanded into ordinary goto.

gcc/ada/

* sem_ch9.adb (Allows_Lock_Free_Implementation): Reject
conditional goto statements.

gcc/ada/sem_ch9.adb

index 6506358a02b778d0a2bf59cfe733e9e166beb4cb..f2a5901786538a1981c780ed21735a2cd164b874 100644 (file)
@@ -453,7 +453,7 @@ package body Sem_Ch9 is
 
                   --  Goto statements restricted
 
-                  elsif Kind = N_Goto_Statement then
+                  elsif Kind in N_Goto_Statement | N_Goto_When_Statement then
                      if Lock_Free_Given then
                         Error_Msg_N ("goto statement not allowed", N);
                         return Skip;