public inbox for
 help / color / mirror / Atom feed
* [COMMITED] ada: Reject conditional goto in lock-free protected subprograms
@ 2022-10-06  9:31 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2022-10-06  9:31 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

From: Piotr Trojanek <>

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.


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

Tested on x86_64-pc-linux-gnu, committed on master.

 gcc/ada/sem_ch9.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb
index 6506358a02b..f2a59017865 100644
--- a/gcc/ada/sem_ch9.adb
+++ b/gcc/ada/sem_ch9.adb
@@ -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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-06  9:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-06  9:31 [COMMITED] ada: Reject conditional goto in lock-free protected subprograms Marc Poulhiès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).