[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 11 Oct 2010 08:48:19 +0000 (10:48 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 11 Oct 2010 08:48:19 +0000 (10:48 +0200)
2010-10-11  Ed Schonberg  <schonberg@adacore.com>

* exp_ch6.adb (Expand_Actuals): If an actual is the current instance of
a task type, it must be replaced with a reference to Self.

2010-10-11  Vincent Celier  <celier@adacore.com>

* adaint.h: Add prototype for function __gnat_create_output_file_new.

2010-10-11  Javier Miranda  <miranda@adacore.com>

* sem_aggr.adb (Collect_Aggr_Bounds): Remove side effects of collected
aggregate bounds.

From-SVN: r165280

gcc/ada/ChangeLog
gcc/ada/adaint.h
gcc/ada/exp_ch6.adb
gcc/ada/sem_aggr.adb

index c04dbe2..30110fb 100644 (file)
@@ -1,3 +1,17 @@
+2010-10-11  Ed Schonberg  <schonberg@adacore.com>
+
+       * exp_ch6.adb (Expand_Actuals): If an actual is the current instance of
+       a task type, it must be replaced with a reference to Self.
+
+2010-10-11  Vincent Celier  <celier@adacore.com>
+
+       * adaint.h: Add prototype for function __gnat_create_output_file_new.
+
+2010-10-11  Javier Miranda  <miranda@adacore.com>
+
+       * sem_aggr.adb (Collect_Aggr_Bounds): Remove side effects of collected
+       aggregate bounds.
+
 2010-10-11  Arnaud Charlet  <charlet@adacore.com>
 
        * sem_prag.adb (Check_Interrupt_Or_Attach_Handler): Do not emit error
index 999c024..e9ef42c 100644 (file)
@@ -131,6 +131,8 @@ extern int    __gnat_open_read                     (char *, int);
 extern int    __gnat_open_rw                       (char *, int);
 extern int    __gnat_open_create                   (char *, int);
 extern int    __gnat_create_output_file            (char *);
+extern int    __gnat_create_output_file_new        (char *);
+
 extern int    __gnat_open_append                   (char *, int);
 extern long   __gnat_file_length                   (int);
 extern long   __gnat_named_file_length             (char *);
index 423e24b..d94117f 100644 (file)
@@ -1654,6 +1654,24 @@ package body Exp_Ch6 is
 
             elsif Is_Possibly_Unaligned_Slice (Actual) then
                Add_Call_By_Copy_Code;
+
+            --  An unusual case: a current instance of an enclosing task can be
+            --  an actual, and must be replaced by a reference to self.
+
+            elsif Is_Entity_Name (Actual)
+              and then Is_Task_Type (Entity (Actual))
+            then
+               if In_Open_Scopes (Entity (Actual)) then
+                  Rewrite (Actual,
+                    (Make_Function_Call (Loc,
+                     Name => New_Reference_To (RTE (RE_Self), Loc))));
+                  Analyze (Actual);
+
+               --  A task type cannot otherwise appear as an actual
+
+               else
+                  raise Program_Error;
+               end if;
             end if;
          end if;
 
index 5574f65..c634b7f 100644 (file)
@@ -526,9 +526,10 @@ package body Sem_Aggr is
       Is_Fully_Positional : Boolean := True;
 
       procedure Collect_Aggr_Bounds (N : Node_Id; Dim : Pos);
-      --  N is an array (sub-)aggregate. Dim is the dimension corresponding to
-      --  (sub-)aggregate N. This procedure collects the constrained N_Range
-      --  nodes corresponding to each index dimension of our aggregate itype.
+      --  N is an array (sub-)aggregate. Dim is the dimension corresponding
+      --  to (sub-)aggregate N. This procedure collects and removes the side
+      --  effects of the constrained N_Range nodes corresponding to each index
+      --  dimension of our aggregate itype.
       --  These N_Range nodes are collected in Aggr_Range above.
       --
       --  Likewise collect in Aggr_Low & Aggr_High above the low and high
@@ -552,6 +553,9 @@ package body Sem_Aggr is
          Expr  : Node_Id;
 
       begin
+         Remove_Side_Effects (This_Low,  Variable_Ref => True);
+         Remove_Side_Effects (This_High, Variable_Ref => True);
+
          --  Collect the first N_Range for a given dimension that you find.
          --  For a given dimension they must be all equal anyway.