diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-11-23 12:24:48 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-11-23 12:24:48 +0100 |
commit | c269a1f5c9c3904c35ed2ac320e6620c7f47ea57 (patch) | |
tree | 3801b3b0ce11d58d1c4a23076336e38db3baa05d /gcc/ada/exp_util.adb | |
parent | f947ee3467dee8ca1b681c459804b02657113e9d (diff) | |
download | gcc-c269a1f5c9c3904c35ed2ac320e6620c7f47ea57.zip gcc-c269a1f5c9c3904c35ed2ac320e6620c7f47ea57.tar.gz gcc-c269a1f5c9c3904c35ed2ac320e6620c7f47ea57.tar.bz2 |
[multiple changes]
2011-11-23 Robert Dewar <dewar@adacore.com>
* sem_ch9.adb (Analyze_Entry_Declaration): Check for entry
family bounds out of range.
2011-11-23 Matthew Heaney <heaney@adacore.com>
* a-cohama.adb, a-cihama.adb, a-cbhama.adb (Iterator): Declare
type as limited, and remove node component.
(First, Next): Forward call to corresponding cursor-based operation.
(Iterate): Representation of iterator no longer has node component.
2011-11-23 Yannick Moy <moy@adacore.com>
* exp_util.adb: Revert previous change to remove side-effects in Alfa
mode, which is not the correct thing to do for renamings.
2011-11-23 Thomas Quinot <quinot@adacore.com>
* s-osinte-hpux.ads, s-taprop-vxworks.adb, s-taprop-tru64.adb,
s-osinte-vxworks.ads, s-osinte-aix.ads, s-osinte-lynxos.ads,
s-osinte-solaris-posix.ads, s-taprop-solaris.adb, a-exetim-posix.adb,
s-osinte-irix.ads, s-osinte-solaris.ads, s-oscons-tmplt.c,
s-taprop-irix.adb, s-osinte-hpux-dce.ads, Makefile.rtl,
s-osinte-tru64.ads, s-osinte-darwin.ads, s-taprop.ads,
s-osinte-freebsd.ads, s-osinte-lynxos-3.ads, s-taprop-hpux-dce.adb,
s-taprop-posix.adb: Remove hard-coded clock ids;
instead, generate them in System.OS_Constants.
(System.OS_Constants.CLOCK_RT_Ada): New constant denoting the
id of the clock providing Ada.Real_Time.Monotonic_Clock.
* thread.c: New file.
(__gnat_pthread_condattr_setup): New function. For platforms where
CLOCK_RT_Ada is not CLOCK_REALTIME, set appropriate condition
variable attribute.
2011-11-23 Yannick Moy <moy@adacore.com>
* sem_ch3.adb: Restore the use of Expander_Active instead of
Full_Expander_Active, so that the evaluation is forced in Alfa
mode too. Otherwise, we end up with an unexpected insertion in a
place where it is not supposed to happen, on default parameters
of a call.
2011-11-23 Thomas Quinot <quinot@adacore.com>
* prj-pp.adb, prj-pp.ads: Minor new addition: wrapper procedure "wpr"
for Pretty_Print, for use from within gdb.
From-SVN: r181660
Diffstat (limited to 'gcc/ada/exp_util.adb')
-rw-r--r-- | gcc/ada/exp_util.adb | 69 |
1 files changed, 41 insertions, 28 deletions
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index c0396b4..c67d011 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -6420,19 +6420,9 @@ package body Exp_Util is -- Start of processing for Remove_Side_Effects begin - -- We only need to do removal of side effects if we are generating - -- actual code. That's because the whole issue of side effects is purely - -- a run-time issue, and the removal is required only to get proper - -- behavior at run-time. - - -- In the Alfa case, we don't need to remove side effects because formal - -- verification is performed only on expressions that are provably - -- side-effect free. If we tried to remove side effects in the Alfa - -- case, we would get into a mess since in the case of limited types in - -- particular, removal of side effects involves the use of access types - -- or references which are not permitted in Alfa mode. - - if not Full_Expander_Active then + -- Handle cases in which there is nothing to do + + if not Expander_Active then return; end if; @@ -6633,6 +6623,15 @@ package body Exp_Util is -- Otherwise we generate a reference to the value else + -- An expression which is in Alfa mode is considered side effect free + -- if the resulting value is captured by a variable or a constant. + + if Alfa_Mode + and then Nkind (Parent (Exp)) = N_Object_Declaration + then + return; + end if; + -- Special processing for function calls that return a limited type. -- We need to build a declaration that will enable build-in-place -- expansion of the call. This is not done if the context is already @@ -6667,25 +6666,39 @@ package body Exp_Util is Def_Id := Make_Temporary (Loc, 'R', Exp); Set_Etype (Def_Id, Exp_Type); - Res := - Make_Explicit_Dereference (Loc, - Prefix => New_Reference_To (Def_Id, Loc)); + -- The regular expansion of functions with side effects involves the + -- generation of an access type to capture the return value found on + -- the secondary stack. Since Alfa (and why) cannot process access + -- types, use a different approach which ignores the secondary stack + -- and "copies" the returned object. - -- Generate: - -- type Ann is access all <Exp_Type>; + if Alfa_Mode then + Res := New_Reference_To (Def_Id, Loc); + Ref_Type := Exp_Type; + + -- Regular expansion utilizing an access type and 'reference - Ref_Type := Make_Temporary (Loc, 'A'); + else + Res := + Make_Explicit_Dereference (Loc, + Prefix => New_Reference_To (Def_Id, Loc)); - Ptr_Typ_Decl := - Make_Full_Type_Declaration (Loc, - Defining_Identifier => Ref_Type, - Type_Definition => - Make_Access_To_Object_Definition (Loc, - All_Present => True, - Subtype_Indication => - New_Reference_To (Exp_Type, Loc))); + -- Generate: + -- type Ann is access all <Exp_Type>; - Insert_Action (Exp, Ptr_Typ_Decl); + Ref_Type := Make_Temporary (Loc, 'A'); + + Ptr_Typ_Decl := + Make_Full_Type_Declaration (Loc, + Defining_Identifier => Ref_Type, + Type_Definition => + Make_Access_To_Object_Definition (Loc, + All_Present => True, + Subtype_Indication => + New_Reference_To (Exp_Type, Loc))); + + Insert_Action (Exp, Ptr_Typ_Decl); + end if; E := Exp; if Nkind (E) = N_Explicit_Dereference then |