[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Tue, 29 Jul 2014 12:50:18 +0000 (14:50 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 29 Jul 2014 12:50:18 +0000 (14:50 +0200)
2014-07-29  Robert Dewar  <dewar@adacore.com>

* errout.adb: Minor reformatting.

2014-07-29  Hristian Kirtchev  <kirtchev@adacore.com>

* exp_ch3.adb (Default_Initialize_Object): Add new variables
Abrt_Blk and Dummy. Generate a dummy temporary when aborts are
not allowed to ensure the symmetrical generation of symbols.
* exp_ch7.adb (Build_Object_Declarations): Remove variables A_Expr
and E_Decl. Add new variables Decl and Dummy. Generate a dummy
temporary when aborts are not allowed to ensure symmertrical
generation of symbols.
* exp_intr.adb (Expand_Unc_Deallocation): Add new variable
Dummy. Generate a dummy temporary when aborts are not allowed
to ensure symmertrical generation of symbols.

2014-07-29  Ed Schonberg  <schonberg@adacore.com>

* exp_dbug.adb (Debug_Renaming_Declaration): For an object
renaming, indicate that the renamed entity itself needs debug
information. This is necessary if that entity is a temporary,
e.g. part of the expansion of an explicit dereference in an
iterator.

From-SVN: r213157

gcc/ada/ChangeLog
gcc/ada/errout.adb
gcc/ada/exp_ch3.adb
gcc/ada/exp_ch7.adb
gcc/ada/exp_dbug.adb
gcc/ada/exp_intr.adb

index b74401a4a56cbfe10fbecbbc02192d301c35096e..3b7ae6bbef2c085d0212d6eb757a5bf4841f1343 100644 (file)
@@ -1,3 +1,28 @@
+2014-07-29  Robert Dewar  <dewar@adacore.com>
+
+       * errout.adb: Minor reformatting.
+
+2014-07-29  Hristian Kirtchev  <kirtchev@adacore.com>
+
+       * exp_ch3.adb (Default_Initialize_Object): Add new variables
+       Abrt_Blk and Dummy. Generate a dummy temporary when aborts are
+       not allowed to ensure the symmetrical generation of symbols.
+       * exp_ch7.adb (Build_Object_Declarations): Remove variables A_Expr
+       and E_Decl. Add new variables Decl and Dummy. Generate a dummy
+       temporary when aborts are not allowed to ensure symmertrical
+       generation of symbols.
+       * exp_intr.adb (Expand_Unc_Deallocation): Add new variable
+       Dummy. Generate a dummy temporary when aborts are not allowed
+       to ensure symmertrical generation of symbols.
+
+2014-07-29  Ed Schonberg  <schonberg@adacore.com>
+
+       * exp_dbug.adb (Debug_Renaming_Declaration): For an object
+       renaming, indicate that the renamed entity itself needs debug
+       information. This is necessary if that entity is a temporary,
+       e.g. part of the expansion of an explicit dereference in an
+       iterator.
+
 2014-07-29  Thomas Quinot  <quinot@adacore.com>
 
        * errout.adb (Set_Error_Posted): When propagating flag to
index a18627cb582773654ccaf346307ba14e3d0158ec..1274b31ea1c93a34e3789e4a68c6a4557e0304ca 100644 (file)
@@ -3008,12 +3008,11 @@ package body Errout is
             exit when Nkind (P) not in N_Subexpr;
          end loop;
 
-         if Nkind_In (P,
-              N_Pragma_Argument_Association,
-              N_Component_Association,
-              N_Discriminant_Association,
-              N_Generic_Association,
-              N_Parameter_Association)
+         if Nkind_In (P, N_Pragma_Argument_Association,
+                         N_Component_Association,
+                         N_Discriminant_Association,
+                         N_Generic_Association,
+                         N_Parameter_Association)
          then
             Set_Error_Posted (Parent (P));
          end if;
index 160cfea761f4f1b75dc5d7dd439772936d0694c8..f454768e1040e7b19b05972604c2c907236f1e7f 100644 (file)
@@ -5031,6 +5031,7 @@ package body Exp_Ch3 is
 
          --  Local variables
 
+         Abrt_Blk   : Node_Id;
          Abrt_HSS   : Node_Id;
          Abrt_Id    : Entity_Id;
          Abrt_Stmts : List_Id;
@@ -5041,6 +5042,11 @@ package body Exp_Ch3 is
          Obj_Init   : Node_Id := Empty;
          Obj_Ref    : Node_Id;
 
+         Dummy : Entity_Id;
+         pragma Unreferenced (Dummy);
+         --  This variable captures an unused dummy internal entity, see the
+         --  comment associated with its use.
+
       --  Start of processing for Default_Initialize_Object
 
       begin
@@ -5205,47 +5211,53 @@ package body Exp_Ch3 is
 
          --  Step 3b: Build the abort block (if applicable)
 
-         --  The abort block is required when aborts are allowed and there is
-         --  at least one initialization call that needs protection.
+         --  The abort block is required when aborts are allowed in order to
+         --  protect both initialization calls.
 
-         if Abort_Allowed
-           and then Present (Comp_Init)
-           and then Present (Obj_Init)
-         then
-            --  Generate:
-            --    Abort_Defer;
+         if Present (Comp_Init) and then Present (Obj_Init) then
+            if Abort_Allowed then
 
-            Prepend_To (Fin_Stmts, Build_Runtime_Call (Loc, RE_Abort_Defer));
+               --  Generate:
+               --    Abort_Defer;
 
-            --  Generate:
-            --    begin
-            --       Abort_Defer;
-            --       <finalization statements>
-            --    at end
-            --       Abort_Undefer_Direct;
-            --    end;
+               Prepend_To
+                 (Fin_Stmts, Build_Runtime_Call (Loc, RE_Abort_Defer));
 
-            Abrt_Id := New_Internal_Entity (E_Block, Current_Scope, Loc, 'B');
-            Set_Etype (Abrt_Id, Standard_Void_Type);
-            Set_Scope (Abrt_Id, Current_Scope);
+               --  Generate:
+               --    begin
+               --       Abort_Defer;
+               --       <finalization statements>
+               --    at end
+               --       Abort_Undefer_Direct;
+               --    end;
+
+               Abrt_HSS :=
+                 Make_Handled_Sequence_Of_Statements (Loc,
+                   Statements  => Fin_Stmts,
+                   At_End_Proc =>
+                     New_Occurrence_Of (RTE (RE_Abort_Undefer_Direct), Loc));
 
-            Abrt_HSS :=
-              Make_Handled_Sequence_Of_Statements (Loc,
-                Statements  => Fin_Stmts,
-                At_End_Proc =>
-                  New_Occurrence_Of (RTE (RE_Abort_Undefer_Direct), Loc));
+               Abrt_Blk :=
+                 Make_Block_Statement (Loc,
+                   Declarations               => No_List,
+                   Handled_Statement_Sequence => Abrt_HSS);
+
+               Add_Block_Identifier (Abrt_Blk, Abrt_Id);
+               Expand_At_End_Handler (Abrt_HSS, Abrt_Id);
 
-            Abrt_Stmts := New_List (
-              Make_Block_Statement (Loc,
-                Identifier                 => New_Occurrence_Of (Abrt_Id, Loc),
-                Declarations               => No_List,
-                Handled_Statement_Sequence => Abrt_HSS));
+               Abrt_Stmts := New_List (Abrt_Blk);
 
-            Expand_At_End_Handler (Abrt_HSS, Abrt_Id);
+            --  Abort is not required
+
+            else
+               --  Generate a dummy entity to ensure that the internal symbols
+               --  are in sync when a unit is compiled with and without aborts.
+
+               Dummy := New_Internal_Entity (E_Block, Current_Scope, Loc, 'B');
+               Abrt_Stmts := Fin_Stmts;
+            end if;
 
-         --  Abort is not required, the construct from Step 3a is to be added
-         --  in the tree (either finalization block or single initialization
-         --  call).
+         --  No initialization calls present
 
          else
             Abrt_Stmts := Fin_Stmts;
index ad7a1d20bf4278afff30e01ca0d58e48d7226263..a714d20e829ef87d6a61e8d325fa834e045b9089 100644 (file)
@@ -3134,8 +3134,12 @@ package body Exp_Ch7 is
       Loc         : Source_Ptr;
       For_Package : Boolean := False)
    is
-      A_Expr : Node_Id;
-      E_Decl : Node_Id;
+      Decl : Node_Id;
+
+      Dummy : Entity_Id;
+      pragma Unreferenced (Dummy);
+      --  This variable captures an unused dummy internal entity, see the
+      --  comment associated with its use.
 
    begin
       pragma Assert (Decls /= No_List);
@@ -3164,56 +3168,61 @@ package body Exp_Ch7 is
       --  does not include routine Raise_From_Controlled_Operation which is the
       --  the sole user of flag Abort.
 
-      --  This is not needed for library-level finalizers as they are called
-      --  by the environment task and cannot be aborted.
+      --  This is not needed for library-level finalizers as they are called by
+      --  the environment task and cannot be aborted.
 
-      if Abort_Allowed
-        and then VM_Target = No_VM
-        and then not For_Package
-      then
-         Data.Abort_Id  := Make_Temporary (Loc, 'A');
+      if VM_Target = No_VM and then not For_Package then
+         if Abort_Allowed then
+            Data.Abort_Id := Make_Temporary (Loc, 'A');
 
-         A_Expr := New_Occurrence_Of (RTE (RE_Triggered_By_Abort), Loc);
+            --  Generate:
+            --    Abort_Id : constant Boolean := <A_Expr>;
 
-         --  Generate:
+            Append_To (Decls,
+              Make_Object_Declaration (Loc,
+                Defining_Identifier => Data.Abort_Id,
+                Constant_Present    => True,
+                Object_Definition   =>
+                  New_Occurrence_Of (Standard_Boolean, Loc),
+                Expression          =>
+                  New_Occurrence_Of (RTE (RE_Triggered_By_Abort), Loc)));
 
-         --    Abort_Id : constant Boolean := <A_Expr>;
+         --  Abort is not required
 
-         Append_To (Decls,
-           Make_Object_Declaration (Loc,
-             Defining_Identifier => Data.Abort_Id,
-             Constant_Present    => True,
-             Object_Definition   => New_Occurrence_Of (Standard_Boolean, Loc),
-             Expression          => A_Expr));
+         else
+            --  Generate a dummy entity to ensure that the internal symbols are
+            --  in sync when a unit is compiled with and without aborts.
 
-      else
-         --  No abort, .NET/JVM or library-level finalizers
+            Dummy := Make_Temporary (Loc, 'A');
+            Data.Abort_Id := Empty;
+         end if;
 
-         Data.Abort_Id  := Empty;
+      --  .NET/JVM or library-level finalizers
+
+      else
+         Data.Abort_Id := Empty;
       end if;
 
       if Exception_Extra_Info then
-         Data.E_Id      := Make_Temporary (Loc, 'E');
+         Data.E_Id := Make_Temporary (Loc, 'E');
 
          --  Generate:
-
          --    E_Id : Exception_Occurrence;
 
-         E_Decl :=
+         Decl :=
            Make_Object_Declaration (Loc,
              Defining_Identifier => Data.E_Id,
              Object_Definition   =>
                New_Occurrence_Of (RTE (RE_Exception_Occurrence), Loc));
-         Set_No_Initialization (E_Decl);
+         Set_No_Initialization (Decl);
 
-         Append_To (Decls, E_Decl);
+         Append_To (Decls, Decl);
 
       else
-         Data.E_Id      := Empty;
+         Data.E_Id := Empty;
       end if;
 
       --  Generate:
-
       --    Raised_Id : Boolean := False;
 
       Append_To (Decls,
index cbd4c55d949fc81f21b2854941b551f3beda07fa..7337acc7c97eddddd32cdfcebf6afafea1f82610 100644 (file)
@@ -479,6 +479,13 @@ package body Exp_Dbug is
 
       Set_Debug_Info_Needed (Obj);
 
+      --  The renamed entity may be a temporary, e.g. the result of an
+      --  implicit dereference in an iterator. Indicate that the temporary
+      --  itself requires debug information. If the renamed entity comes
+      --  from source this is a no-op.
+
+      Set_Debug_Info_Needed (Entity (Ren));
+
       --  Mark the object as internal so that it won't be initialized when
       --  pragma Initialize_Scalars or Normalize_Scalars is in use.
 
index a4a498904f4daa51013e427b7b14265b141f16d8..3c6eb7468fa36e5573344d39fa80b1e12ab9473a 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -914,6 +914,7 @@ package body Exp_Intr is
       Finalizer_Data  : Finalization_Exception_Data;
 
       Blk        : Node_Id := Empty;
+      Blk_Id     : Entity_Id;
       Deref      : Node_Id;
       Final_Code : List_Id;
       Free_Arg   : Node_Id;
@@ -926,6 +927,11 @@ package body Exp_Intr is
       --  that we analyze some generated statements before properly attaching
       --  them to the tree, and that can disturb current value settings.
 
+      Dummy : Entity_Id;
+      pragma Unreferenced (Dummy);
+      --  This variable captures an unused dummy internal entity, see the
+      --  comment associated with its use.
+
    begin
       --  Nothing to do if we know the argument is null
 
@@ -1007,8 +1013,7 @@ package body Exp_Intr is
          --  protected by an abort defer/undefer pair.
 
          if Abort_Allowed then
-            Prepend_To (Final_Code,
-              Build_Runtime_Call (Loc, RE_Abort_Defer));
+            Prepend_To (Final_Code, Build_Runtime_Call (Loc, RE_Abort_Defer));
 
             Blk :=
               Make_Block_Statement (Loc, Handled_Statement_Sequence =>
@@ -1016,9 +1021,15 @@ package body Exp_Intr is
                   Statements  => Final_Code,
                   At_End_Proc =>
                     New_Occurrence_Of (RTE (RE_Abort_Undefer_Direct), Loc)));
+            Add_Block_Identifier (Blk, Blk_Id);
 
             Append (Blk, Stmts);
+
          else
+            --  Generate a dummy entity to ensure that the internal symbols are
+            --  in sync when a unit is compiled with and without aborts.
+
+            Dummy := New_Internal_Entity (E_Block, Current_Scope, Loc, 'B');
             Append_List_To (Stmts, Final_Code);
          end if;
       end if;