diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-20 11:41:57 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-20 11:41:57 +0000 |
commit | 472ea1606da75c8cfa737734f05f393119e60fa0 (patch) | |
tree | 5f5d1a77edd05aad05f51a5a22f62a33e92189e0 | |
parent | 2d28bdfd8a62cc75ced5b423e50b936b301d73a9 (diff) |
2011-11-20 Eric Botcazou <ebotcazou@adacore.com>
* exp_ch6.adb (Make_Build_In_Place_Call_In_Assignment):
Declare NEW_EXPR local variable and attach the
temporary to it. Set Is_Known_Non_Null on the temporary.
(Make_Build_In_Place_Call_In_Object_Declaration): Likewise.
* exp_util.adb (Remove_Side_Effects): Set Is_Known_Non_Null on
the temporary created to hold the 'Reference of the expression,
if any.
* checks.adb (Install_Null_Excluding_Check): Bail out for the
Get_Current_Excep.all.all idiom generated by the expander.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181529 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ada/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/ada/checks.adb | 16 | ||||
-rw-r--r-- | gcc/ada/exp_ch6.adb | 9 | ||||
-rw-r--r-- | gcc/ada/exp_util.adb | 1 |
4 files changed, 36 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e6bc5c7b835..35a2096ca37 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,17 @@ 2011-11-20 Eric Botcazou <ebotcazou@adacore.com> + * exp_ch6.adb (Make_Build_In_Place_Call_In_Assignment): + Declare NEW_EXPR local variable and attach the + temporary to it. Set Is_Known_Non_Null on the temporary. + (Make_Build_In_Place_Call_In_Object_Declaration): Likewise. + * exp_util.adb (Remove_Side_Effects): Set Is_Known_Non_Null on + the temporary created to hold the 'Reference of the expression, + if any. + * checks.adb (Install_Null_Excluding_Check): Bail out for the + Get_Current_Excep.all.all idiom generated by the expander. + +2011-11-20 Eric Botcazou <ebotcazou@adacore.com> + * gcc-interface/trans.c (struct language_function): Add GNAT_RET. (f_gnat_ret): New macro. (struct nrv_data): Add GNAT_RET. diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 67febfe1919..e6d8bf996ef 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -5673,6 +5673,22 @@ package body Checks is return; end if; + -- No check needed for the Get_Current_Excep.all.all idiom generated by + -- the expander within exception handlers, since we know that the value + -- can never be null. + + -- Is this really the right way to do this? Normally we generate such + -- code in the expander with checks off, and that's how we suppress this + -- kind of junk check ??? + + if Nkind (N) = N_Function_Call + and then Nkind (Name (N)) = N_Explicit_Dereference + and then Nkind (Prefix (Name (N))) = N_Identifier + and then Is_RTE (Entity (Prefix (Name (N))), RE_Get_Current_Excep) + then + return; + end if; + -- Otherwise install access check Insert_Action (N, diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 6049c452cb8..f3d915de74a 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -7954,6 +7954,7 @@ package body Exp_Ch6 is Obj_Id : Entity_Id; Ptr_Typ : Entity_Id; Ptr_Typ_Decl : Node_Id; + New_Expr : Node_Id; Result_Subt : Entity_Id; Target : Node_Id; @@ -8035,14 +8036,17 @@ package body Exp_Ch6 is -- Finally, create an access object initialized to a reference to the -- function call. - Obj_Id := Make_Temporary (Loc, 'R'); + New_Expr := Make_Reference (Loc, Relocate_Node (Func_Call)); + + Obj_Id := Make_Temporary (Loc, 'R', New_Expr); Set_Etype (Obj_Id, Ptr_Typ); + Set_Is_Known_Non_Null (Obj_Id); Obj_Decl := Make_Object_Declaration (Loc, Defining_Identifier => Obj_Id, Object_Definition => New_Reference_To (Ptr_Typ, Loc), - Expression => Make_Reference (Loc, Relocate_Node (Func_Call))); + Expression => New_Expr); Insert_After_And_Analyze (Ptr_Typ_Decl, Obj_Decl); Rewrite (Assign, Make_Null_Statement (Loc)); @@ -8301,6 +8305,7 @@ package body Exp_Ch6 is Def_Id := Make_Temporary (Loc, 'R', New_Expr); Set_Etype (Def_Id, Ref_Type); + Set_Is_Known_Non_Null (Def_Id); Insert_After_And_Analyze (Ptr_Typ_Decl, Make_Object_Declaration (Loc, diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index e675da82889..56a6f20ed19 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -6712,6 +6712,7 @@ package body Exp_Util is New_Exp := E; else New_Exp := Make_Reference (Loc, E); + Set_Is_Known_Non_Null (Def_Id); end if; end if; |