From fb468a944c0dae2086e811b18d2da7935f642fc5 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 11 Oct 2010 10:48:19 +0200 Subject: [PATCH] [multiple changes] 2010-10-11 Ed Schonberg * 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 * adaint.h: Add prototype for function __gnat_create_output_file_new. 2010-10-11 Javier Miranda * sem_aggr.adb (Collect_Aggr_Bounds): Remove side effects of collected aggregate bounds. From-SVN: r165280 --- gcc/ada/ChangeLog | 14 ++++++++++++++ gcc/ada/adaint.h | 2 ++ gcc/ada/exp_ch6.adb | 18 ++++++++++++++++++ gcc/ada/sem_aggr.adb | 10 +++++++--- 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c04dbe29895..30110fb3946 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,17 @@ +2010-10-11 Ed Schonberg + + * 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 + + * adaint.h: Add prototype for function __gnat_create_output_file_new. + +2010-10-11 Javier Miranda + + * sem_aggr.adb (Collect_Aggr_Bounds): Remove side effects of collected + aggregate bounds. + 2010-10-11 Arnaud Charlet * sem_prag.adb (Check_Interrupt_Or_Attach_Handler): Do not emit error diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h index 999c024eca8..e9ef42c6b2b 100644 --- a/gcc/ada/adaint.h +++ b/gcc/ada/adaint.h @@ -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 *); diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 423e24b8000..d94117f41fd 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -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; diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 5574f658d7f..c634b7fb87d 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -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. -- 2.30.2