public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Crash on task declaration with Restriction_Warning (No_Tasking)
@ 2020-11-26  8:41 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2020-11-26  8:41 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ed Schonberg

[-- Attachment #1: Type: text/plain, Size: 556 bytes --]

Compiler aborts when the Restriction_Warning (No_Tasking) appears as a
configuration pragma, and the main unit includes a task declaration.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
	when the restriction is a configuration pragma and specifies
	No_Tasking, a global flag is set to reject task declarations,
	and to prevent the construction of Master entities. The flag
	must not be set if the pragma is a Restriction_Warning, in which
	case task declarationns are allowed.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 844 bytes --]

diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -10438,10 +10438,13 @@ package body Sem_Prag is
                      Add_To_Config_Boolean_Restrictions (No_Elaboration_Code);
                   end if;
 
-               --  Special processing for No_Tasking restriction placed in
-               --  a configuration pragmas file.
+               --  Special processing for No_Tasking restriction (not just a
+               --  warning) when it appears as a configuration pragmas.
 
-               elsif R_Id = No_Tasking and then No (Cunit (Main_Unit)) then
+               elsif R_Id = No_Tasking
+                 and then No (Cunit (Main_Unit))
+                 and then not Warn
+               then
                   Set_Global_No_Tasking;
                end if;
 



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

only message in thread, other threads:[~2020-11-26  8:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26  8:41 [Ada] Crash on task declaration with Restriction_Warning (No_Tasking) Pierre-Marie de Rodat

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).