sem_smem.adb (Check_Shared_Var): Check explicitly for as task object, to prevent...
authorEd Schonberg <schonberg@adacore.com>
Wed, 6 Jun 2007 10:47:17 +0000 (12:47 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 6 Jun 2007 10:47:17 +0000 (12:47 +0200)
2007-04-20  Ed Schonberg  <schonberg@adacore.com>

* sem_smem.adb (Check_Shared_Var): Check explicitly for as task object,
to prevent subsequent expansion.

From-SVN: r125461

gcc/ada/sem_smem.adb

index 2682c88c7d4678f2fab8ea6119dd247d573dc69c..6584867f8433f2860ed4180e246d4ff2231107af 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1998-2000, Free Software Foundation, Inc.         --
+--          Copyright (C) 1998-2007, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -77,6 +77,15 @@ package body Sem_Smem is
             "not supported in Shared_Passive partitions",
             Id);
 
+      --  Objects with default-initialized types will be rejected when
+      --  the initialization code is generated. However we must flag tasks
+      --  earlier on, to prevent expansion of stream attributes that is
+      --  bound to fail.
+
+      elsif Has_Task (T) then
+         Error_Msg_N
+           ("Shared_Passive partitions cannot contain tasks", Id);
+
       --  Currently we do not support unconstrained record types, since we
       --  use 'Write to write out values. This could probably be special
       --  cased and handled in the future if necessary.