Index: exp_aggr.adb
===================================================================
--- exp_aggr.adb	(revision 253567)
+++ exp_aggr.adb	(working copy)
@@ -4125,25 +4125,6 @@
    -- Convert_To_Assignments --
    ----------------------------
 
-   function Is_Build_In_Place_Aggregate_Return (N : Node_Id) return Boolean is
-      P : Node_Id := Parent (N);
-   begin
-      while Nkind (P) = N_Qualified_Expression loop
-         P := Parent (P);
-      end loop;
-
-      if Nkind (P) = N_Simple_Return_Statement then
-         null;
-      elsif Nkind (Parent (P)) = N_Extended_Return_Statement then
-         P := Parent (P);
-      else
-         return False;
-      end if;
-
-      return Is_Build_In_Place_Function
-        (Return_Applies_To (Return_Statement_Entity (P)));
-   end Is_Build_In_Place_Aggregate_Return;
-
    procedure Convert_To_Assignments (N : Node_Id; Typ : Entity_Id) is
       Loc  : constant Source_Ptr := Sloc (N);
       T    : Entity_Id;
@@ -4176,8 +4157,9 @@
             Unc_Decl :=
               not Is_Entity_Name (Object_Definition (Parent_Node))
                 or else (Nkind (N) = N_Aggregate
-                           and then Has_Discriminants
-                             (Entity (Object_Definition (Parent_Node))))
+                          and then
+                            Has_Discriminants
+                              (Entity (Object_Definition (Parent_Node))))
                 or else Is_Class_Wide_Type
                           (Entity (Object_Definition (Parent_Node)));
          end if;
@@ -6671,8 +6653,8 @@
    --  individual assignments to the given components.
 
    procedure Expand_N_Extension_Aggregate (N : Node_Id) is
+      A   : constant Node_Id    := Ancestor_Part (N);
       Loc : constant Source_Ptr := Sloc (N);
-      A   : constant Node_Id    := Ancestor_Part (N);
       Typ : constant Entity_Id  := Etype (N);
 
    begin
@@ -7476,6 +7458,33 @@
       return False;
    end Has_Default_Init_Comps;
 
+   ----------------------------------------
+   -- Is_Build_In_Place_Aggregate_Return --
+   ----------------------------------------
+
+   function Is_Build_In_Place_Aggregate_Return (N : Node_Id) return Boolean is
+      P : Node_Id := Parent (N);
+
+   begin
+      while Nkind (P) = N_Qualified_Expression loop
+         P := Parent (P);
+      end loop;
+
+      if Nkind (P) = N_Simple_Return_Statement then
+         null;
+
+      elsif Nkind (Parent (P)) = N_Extended_Return_Statement then
+         P := Parent (P);
+
+      else
+         return False;
+      end if;
+
+      return
+        Is_Build_In_Place_Function
+          (Return_Applies_To (Return_Statement_Entity (P)));
+   end Is_Build_In_Place_Aggregate_Return;
+
    --------------------------
    -- Is_Delayed_Aggregate --
    --------------------------
Index: exp_ch3.adb
===================================================================
--- exp_ch3.adb	(revision 253567)
+++ exp_ch3.adb	(working copy)
@@ -1712,7 +1712,8 @@
       Set_Tag   : Entity_Id := Empty;
 
       function Build_Assignment
-        (Id : Entity_Id; Default : Node_Id) return List_Id;
+        (Id      : Entity_Id;
+         Default : Node_Id) return List_Id;
       --  Build an assignment statement that assigns the default expression to
       --  its corresponding record component if defined. The left-hand side of
       --  the assignment is marked Assignment_OK so that initialization of
@@ -1785,10 +1786,11 @@
       ----------------------
 
       function Build_Assignment
-        (Id : Entity_Id; Default : Node_Id) return List_Id
+        (Id      : Entity_Id;
+         Default : Node_Id) return List_Id
       is
          Default_Loc : constant Source_Ptr := Sloc (Default);
-         Typ   : constant Entity_Id := Underlying_Type (Etype (Id));
+         Typ         : constant Entity_Id  := Underlying_Type (Etype (Id));
 
          Adj_Call : Node_Id;
          Exp      : Node_Id   := Default;
@@ -1871,7 +1873,7 @@
 
          if Kind = N_Attribute_Reference
            and then Nam_In (Attribute_Name (Default), Name_Unchecked_Access,
-                                                Name_Unrestricted_Access)
+                                                      Name_Unrestricted_Access)
            and then Is_Entity_Name (Prefix (Default))
            and then Is_Type (Entity (Prefix (Default)))
            and then Entity (Prefix (Default)) = Rec_Type
@@ -1915,9 +1917,8 @@
                 Expression =>
                   Unchecked_Convert_To (RTE (RE_Tag),
                     New_Occurrence_Of
-                      (Node
-                        (First_Elmt
-                          (Access_Disp_Table (Underlying_Type (Typ)))),
+                      (Node (First_Elmt (Access_Disp_Table (Underlying_Type
+                         (Typ)))),
                        Default_Loc))));
          end if;
 
@@ -6328,7 +6329,7 @@
          elsif Nkind (Expr_Q) = N_Reference
            and then Is_Build_In_Place_Function_Call (Prefix (Expr_Q))
            and then not Is_Expanded_Build_In_Place_Call
-             (Unqual_Conv (Prefix (Expr_Q)))
+                          (Unqual_Conv (Prefix (Expr_Q)))
          then
             Make_Build_In_Place_Call_In_Anonymous_Context (Prefix (Expr_Q));
 
@@ -6611,7 +6612,8 @@
                --  allocated in place, delay checks until assignments are
                --  made, because the discriminants are not initialized.
 
-               if Nkind (Expr) = N_Allocator and then No_Initialization (Expr)
+               if Nkind (Expr) = N_Allocator
+                 and then No_Initialization (Expr)
                then
                   null;
 
@@ -6649,9 +6651,9 @@
 
             if Is_Build_In_Place_Result_Type (Typ)
               and then Nkind (Parent (N)) = N_Extended_Return_Statement
-              and then not Is_Definite_Subtype
-                (Etype (Return_Applies_To
-                         (Return_Statement_Entity (Parent (N)))))
+              and then
+                not Is_Definite_Subtype (Etype (Return_Applies_To
+                      (Return_Statement_Entity (Parent (N)))))
             then
                null;
 
Index: exp_ch5.adb
===================================================================
--- exp_ch5.adb	(revision 253567)
+++ exp_ch5.adb	(working copy)
@@ -175,15 +175,16 @@
       Advance   : out Node_Id;
       New_Loop  : out Node_Id)
    is
-      Loc      : constant Source_Ptr := Sloc (N);
-      Stats    : constant List_Id    := Statements (N);
-      Typ      : constant Entity_Id  := Base_Type (Etype (Container));
+      Loc   : constant Source_Ptr := Sloc (N);
+      Stats : constant List_Id    := Statements (N);
+      Typ   : constant Entity_Id  := Base_Type (Etype (Container));
 
+      Has_Element_Op : constant Entity_Id :=
+                         Get_Iterable_Type_Primitive (Typ, Name_Has_Element);
+
       First_Op : Entity_Id;
       Next_Op  : Entity_Id;
 
-      Has_Element_Op : constant Entity_Id :=
-                   Get_Iterable_Type_Primitive (Typ, Name_Has_Element);
    begin
       --  Use the proper set of primitives depending on the direction of
       --  iteration. The legality of a reverse iteration has been checked
@@ -196,7 +197,6 @@
       else
          First_Op := Get_Iterable_Type_Primitive (Typ, Name_First);
          Next_Op  := Get_Iterable_Type_Primitive (Typ, Name_Next);
-         null;
       end if;
 
       --  Declaration for Cursor
Index: exp_ch6.adb
===================================================================
--- exp_ch6.adb	(revision 253567)
+++ exp_ch6.adb	(working copy)
@@ -2251,10 +2251,12 @@
 
    procedure Expand_Call (N : Node_Id) is
       Post_Call : List_Id;
+
    begin
-      pragma Assert
-        (Nkind_In (N, N_Function_Call, N_Procedure_Call_Statement,
-                      N_Entry_Call_Statement));
+      pragma Assert (Nkind_In (N, N_Entry_Call_Statement,
+                                  N_Function_Call,
+                                  N_Procedure_Call_Statement));
+
       Expand_Call_Helper (N, Post_Call);
       Insert_Post_Call_Actions (N, Post_Call);
    end Expand_Call;
@@ -4333,8 +4335,8 @@
          if not Is_Build_In_Place_Function_Call (Call_Node)
            and then
              (No (First_Formal (Subp))
-                or else
-                  not Is_Concurrent_Record_Type (Etype (First_Formal (Subp))))
+               or else
+                 not Is_Concurrent_Record_Type (Etype (First_Formal (Subp))))
          then
             Expand_Ctrl_Function_Call (Call_Node);
 
@@ -4343,15 +4345,14 @@
          --  intermediate result after its use.
 
          elsif Is_Build_In_Place_Function_Call (Call_Node)
-           and then
-             Nkind_In (Parent (Unqual_Conv (Call_Node)),
-                       N_Attribute_Reference,
-                       N_Function_Call,
-                       N_Indexed_Component,
-                       N_Object_Renaming_Declaration,
-                       N_Procedure_Call_Statement,
-                       N_Selected_Component,
-                       N_Slice)
+           and then Nkind_In (Parent (Unqual_Conv (Call_Node)),
+                              N_Attribute_Reference,
+                              N_Function_Call,
+                              N_Indexed_Component,
+                              N_Object_Renaming_Declaration,
+                              N_Procedure_Call_Statement,
+                              N_Selected_Component,
+                              N_Slice)
          then
             Establish_Transient_Scope (Call_Node, Sec_Stack => True);
          end if;
@@ -6447,8 +6448,8 @@
 
       pragma Assert
         (Comes_From_Extended_Return_Statement (N)
-           or else not Is_Build_In_Place_Function_Call (Exp)
-           or else Is_Build_In_Place_Function (Scope_Id));
+          or else not Is_Build_In_Place_Function_Call (Exp)
+          or else Is_Build_In_Place_Function (Scope_Id));
 
       if not Comes_From_Extended_Return_Statement (N)
         and then Is_Build_In_Place_Function (Scope_Id)
@@ -7325,11 +7326,7 @@
          raise Program_Error;
       end if;
 
-      declare
-         Result : constant Boolean := Is_Build_In_Place_Function (Function_Id);
-      begin
-         return Result;
-      end;
+      return Is_Build_In_Place_Function (Function_Id);
    end Is_Build_In_Place_Function_Call;
 
    -----------------------
@@ -7765,7 +7762,7 @@
       Return_Obj_Access := Make_Temporary (Loc, 'R');
       Set_Etype (Return_Obj_Access, Acc_Type);
       Set_Can_Never_Be_Null (Acc_Type, False);
-      --  It gets initialized to null, so we can't have that.
+      --  It gets initialized to null, so we can't have that
 
       --  When the result subtype is constrained, the return object is
       --  allocated on the caller side, and access to it is passed to the
@@ -8101,10 +8098,10 @@
      (Assign        : Node_Id;
       Function_Call : Node_Id)
    is
-      Lhs          : constant Node_Id := Name (Assign);
-      Func_Call    : constant Node_Id := Unqual_Conv (Function_Call);
+      Func_Call    : constant Node_Id    := Unqual_Conv (Function_Call);
+      Lhs          : constant Node_Id    := Name (Assign);
+      Loc          : constant Source_Ptr := Sloc (Function_Call);
       Func_Id      : Entity_Id;
-      Loc          : constant Source_Ptr := Sloc (Function_Call);
       Obj_Decl     : Node_Id;
       Obj_Id       : Entity_Id;
       Ptr_Typ      : Entity_Id;
@@ -8178,8 +8175,9 @@
       --  Add a conversion if it's the wrong type
 
       if Etype (New_Expr) /= Ptr_Typ then
-         New_Expr := Make_Unchecked_Type_Conversion (Loc,
-           New_Occurrence_Of (Ptr_Typ, Loc), New_Expr);
+         New_Expr :=
+           Make_Unchecked_Type_Conversion (Loc,
+             New_Occurrence_Of (Ptr_Typ, Loc), New_Expr);
       end if;
 
       Obj_Id := Make_Temporary (Loc, 'R', New_Expr);
@@ -8207,6 +8205,10 @@
       function Get_Function_Id (Func_Call : Node_Id) return Entity_Id;
       --  Get the value of Function_Id, below
 
+      ---------------------
+      -- Get_Function_Id --
+      ---------------------
+
       function Get_Function_Id (Func_Call : Node_Id) return Entity_Id is
       begin
          if Is_Entity_Name (Name (Func_Call)) then
@@ -8220,22 +8222,23 @@
          end if;
       end Get_Function_Id;
 
-      Func_Call       : constant Node_Id   := Unqual_Conv (Function_Call);
-      Function_Id     : constant Entity_Id := Get_Function_Id (Func_Call);
-      Result_Subt     : constant Entity_Id := Etype (Function_Id);
+      --  Local variables
 
-      Obj_Def_Id : constant Entity_Id  := Defining_Identifier (Obj_Decl);
-      Obj_Typ    : constant Entity_Id  := Etype (Obj_Def_Id);
-      Encl_Func  : constant Entity_Id  := Enclosing_Subprogram (Obj_Def_Id);
-      Loc        : constant Source_Ptr := Sloc (Function_Call);
-      Obj_Loc    : constant Source_Ptr := Sloc (Obj_Decl);
+      Func_Call   : constant Node_Id    := Unqual_Conv (Function_Call);
+      Function_Id : constant Entity_Id  := Get_Function_Id (Func_Call);
+      Loc         : constant Source_Ptr := Sloc (Function_Call);
+      Obj_Loc     : constant Source_Ptr := Sloc (Obj_Decl);
+      Obj_Def_Id  : constant Entity_Id  := Defining_Identifier (Obj_Decl);
+      Obj_Typ     : constant Entity_Id  := Etype (Obj_Def_Id);
+      Encl_Func   : constant Entity_Id  := Enclosing_Subprogram (Obj_Def_Id);
+      Result_Subt : constant Entity_Id  := Etype (Function_Id);
 
       Call_Deref      : Node_Id;
       Caller_Object   : Node_Id;
       Def_Id          : Entity_Id;
+      Designated_Type : Entity_Id;
       Fmaster_Actual  : Node_Id := Empty;
       Pool_Actual     : Node_Id;
-      Designated_Type : Entity_Id;
       Ptr_Typ         : Entity_Id;
       Ptr_Typ_Decl    : Node_Id;
       Pass_Caller_Acc : Boolean := False;
@@ -8243,7 +8246,7 @@
 
       Definite : constant Boolean :=
                    Caller_Known_Size (Func_Call, Result_Subt)
-                   and then not Is_Class_Wide_Type (Obj_Typ);
+                     and then not Is_Class_Wide_Type (Obj_Typ);
       --  In the case of "X : T'Class := F(...);", where F returns a
       --  Caller_Known_Size (specific) tagged type, we treat it as
       --  indefinite, because the code for the Definite case below sets the
@@ -8300,9 +8303,7 @@
       --  the result object is in a different (transient) scope, so won't cause
       --  freezing.
 
-      if Definite
-        and then not Is_Return_Object (Obj_Def_Id)
-      then
+      if Definite and then not Is_Return_Object (Obj_Def_Id) then
          Insert_After_And_Analyze (Obj_Decl, Ptr_Typ_Decl);
       else
          Insert_Action (Obj_Decl, Ptr_Typ_Decl);
@@ -8330,8 +8331,8 @@
          Pass_Caller_Acc := True;
 
          --  When the enclosing function has a BIP_Alloc_Form formal then we
-         --  pass it along to the callee (such as when the enclosing
-         --  function has an unconstrained or tagged result type).
+         --  pass it along to the callee (such as when the enclosing function
+         --  has an unconstrained or tagged result type).
 
          if Needs_BIP_Alloc_Form (Encl_Func) then
             if RTE_Available (RE_Root_Storage_Pool_Ptr) then
@@ -8376,9 +8377,8 @@
            Make_Unchecked_Type_Conversion (Loc,
              Subtype_Mark =>
                New_Occurrence_Of
-                 (Etype
-                    (Build_In_Place_Formal
-                      (Function_Id, BIP_Object_Access)),
+                 (Etype (Build_In_Place_Formal
+                    (Function_Id, BIP_Object_Access)),
                   Loc),
              Expression   =>
                New_Occurrence_Of
@@ -8487,8 +8487,8 @@
       Set_Etype (Def_Id, Ptr_Typ);
       Set_Is_Known_Non_Null (Def_Id);
 
-      if Nkind_In
-        (Function_Call, N_Type_Conversion, N_Unchecked_Type_Conversion)
+      if Nkind_In (Function_Call, N_Type_Conversion,
+                                  N_Unchecked_Type_Conversion)
       then
          Res_Decl :=
            Make_Object_Declaration (Loc,
@@ -8496,9 +8496,9 @@
              Constant_Present    => True,
              Object_Definition   => New_Occurrence_Of (Ptr_Typ, Loc),
              Expression          =>
-             Make_Unchecked_Type_Conversion (Loc,
-                New_Occurrence_Of (Ptr_Typ, Loc),
-                Make_Reference (Loc, Relocate_Node (Func_Call))));
+               Make_Unchecked_Type_Conversion (Loc,
+                 New_Occurrence_Of (Ptr_Typ, Loc),
+                 Make_Reference (Loc, Relocate_Node (Func_Call))));
       else
          Res_Decl :=
            Make_Object_Declaration (Loc,
@@ -8515,9 +8515,8 @@
       --  itself the return expression of an enclosing BIP function, then mark
       --  the object as having no initialization.
 
-      if Definite
-        and then not Is_Return_Object (Obj_Def_Id)
-      then
+      if Definite and then not Is_Return_Object (Obj_Def_Id) then
+
          --  The related object declaration is encased in a transient block
          --  because the build-in-place function call contains at least one
          --  nested function call that produces a controlled transient
@@ -8552,9 +8551,9 @@
          Rewrite (Obj_Decl,
            Make_Object_Renaming_Declaration (Obj_Loc,
              Defining_Identifier => Make_Temporary (Obj_Loc, 'D'),
-             Subtype_Mark =>
+             Subtype_Mark        =>
                New_Occurrence_Of (Designated_Type, Obj_Loc),
-             Name => Call_Deref));
+             Name                => Call_Deref));
 
          --  At this point, Defining_Identifier (Obj_Decl) is no longer equal
          --  to Obj_Def_Id.
@@ -9261,7 +9260,7 @@
          then
             On_Object_Declaration := True;
             return
-               Unqual_BIP_Function_Call (Expression (Parent (Entity (Expr))));
+              Unqual_BIP_Function_Call (Expression (Parent (Entity (Expr))));
 
          --  Recurse to handle calls to displace the pointer to the object to
          --  reference a secondary dispatch table.
@@ -9294,7 +9293,9 @@
 
    begin
       if Nkind (Expr) = N_Identifier and then No (Entity (Expr)) then
-         --  Can happen for X'Elab_Spec in the binder-generated file.
+
+         --  Can happen for X'Elab_Spec in the binder-generated file
+
          return Empty;
       end if;
 
Index: exp_util.adb
===================================================================
--- exp_util.adb	(revision 253567)
+++ exp_util.adb	(working copy)
@@ -651,9 +651,8 @@
       --  stack.
 
       elsif Is_RTE (Pool_Id, RE_SS_Pool)
-        or else
-          (Nkind (Expr) = N_Allocator
-             and then Is_RTE (Storage_Pool (Expr), RE_SS_Pool))
+        or else (Nkind (Expr) = N_Allocator
+                  and then Is_RTE (Storage_Pool (Expr), RE_SS_Pool))
       then
          return;
 
Index: sem_aggr.adb
===================================================================
--- sem_aggr.adb	(revision 253567)
+++ sem_aggr.adb	(working copy)
@@ -3019,17 +3019,20 @@
          return False;
       end Valid_Ancestor_Type;
 
+      ------------------------------
+      -- Transform_BIP_Assignment --
+      ------------------------------
+
       procedure Transform_BIP_Assignment (Typ : Entity_Id) is
-         Loc : constant Source_Ptr := Sloc (N);
-         Def_Id : constant Entity_Id := Make_Temporary (Loc, 'Y', A);
-         Obj_Decl : constant Node_Id :=
-           Make_Object_Declaration
-             (Loc,
-              Defining_Identifier => Def_Id,
-              Constant_Present => True,
-              Object_Definition => New_Occurrence_Of (Typ, Loc),
-              Expression => A,
-              Has_Init_Expression => True);
+         Loc      : constant Source_Ptr := Sloc (N);
+         Def_Id   : constant Entity_Id  := Make_Temporary (Loc, 'Y', A);
+         Obj_Decl : constant Node_Id    :=
+                      Make_Object_Declaration (Loc,
+                        Defining_Identifier => Def_Id,
+                        Constant_Present    => True,
+                        Object_Definition   => New_Occurrence_Of (Typ, Loc),
+                        Expression          => A,
+                        Has_Init_Expression => True);
       begin
          Set_Etype (Def_Id, Typ);
          Set_Ancestor_Part (N, New_Occurrence_Of (Def_Id, Loc));
Index: sem_ch13.adb
===================================================================
--- sem_ch13.adb	(revision 253567)
+++ sem_ch13.adb	(working copy)
@@ -13193,17 +13193,16 @@
            or else No (First_Formal (Entity (N)))
            or else Etype (First_Formal (Entity (N))) /= Typ
          then
-            Error_Msg_N ("iterable primitive must be local function name "
-                         & "whose first formal is an iterable type", N);
+            Error_Msg_N
+              ("iterable primitive must be local function name whose first "
+               & "formal is an iterable type", N);
             return;
          end if;
 
          Ent := Entity (N);
-         F1 := First_Formal (Ent);
+         F1  := First_Formal (Ent);
 
-         if Nam = Name_First
-           or else Nam = Name_Last
-         then
+         if Nam = Name_First or else Nam = Name_Last then
 
             --  First or Last (Container) => Cursor
 
@@ -13242,6 +13241,7 @@
             --  Has_Element (Container, Cursor) => Boolean
 
             F2 := Next_Formal (F1);
+
             if Etype (F2) /= Cursor
               or else Etype (Ent) /= Standard_Boolean
               or else Present (Next_Formal (F2))
@@ -13258,15 +13258,14 @@
             then
                Error_Msg_N ("no match for Element iterable primitive", N);
             end if;
-            null;
 
          else
             raise Program_Error;
          end if;
 
       else
-         --  Overloaded case: find subprogram with proper signature.
-         --  Caller will report error if no match is found.
+         --  Overloaded case: find subprogram with proper signature. Caller
+         --  will report error if no match is found.
 
          declare
             I  : Interp_Index;
@@ -14108,10 +14107,8 @@
       elsif No (Has_Element_Id) then
          Error_Msg_N ("match for Has_Element primitive not found", ASN);
 
-      elsif No (Element_Id)
-        or else No (Last_Id)
-      then
-         null;  --  Optional.
+      elsif No (Element_Id) or else No (Last_Id) then
+         null;  --  optional
       end if;
    end Validate_Iterable_Aspect;
 
Index: sem_ch3.adb
===================================================================
--- sem_ch3.adb	(revision 253567)
+++ sem_ch3.adb	(working copy)
@@ -10255,10 +10255,11 @@
          Set_Is_Limited_Record (Def_Id, Is_Limited_Record (T));
 
          if Has_Discrs
-            and then not Is_Empty_Elmt_List (Elist)
-            and then not For_Access
+           and then not Is_Empty_Elmt_List (Elist)
+           and then not For_Access
          then
             Create_Constrained_Components (Def_Id, Related_Nod, T, Elist);
+
          elsif not For_Access then
             Set_Cloned_Subtype (Def_Id, T);
          end if;
@@ -10288,11 +10289,10 @@
          --  Add_Global_Declaration in this case. This can happen if we have a
          --  build-in-place library function.
 
-         if (Nkind (Nod) in N_Entity
-               and then Is_Compilation_Unit (Nod))
+         if (Nkind (Nod) in N_Entity and then Is_Compilation_Unit (Nod))
            or else
              (Nkind (Nod) = N_Defining_Program_Unit_Name
-                and then Is_Compilation_Unit (Defining_Identifier (Nod)))
+               and then Is_Compilation_Unit (Defining_Identifier (Nod)))
          then
             Add_Global_Declaration (IR);
          else
@@ -11828,14 +11828,14 @@
 
                   else
                      Error_Msg_N
-                       ("illegal context for call"
-                          & " to function with limited result", Exp);
+                       ("illegal context for call to function with limited "
+                        & "result", Exp);
                   end if;
 
                else
                   Error_Msg_N
-                    ("initialization of limited object requires aggregate "
-                      & "or function call",  Exp);
+                    ("initialization of limited object requires aggregate or "
+                     & "function call",  Exp);
                end if;
             end if;
          end if;
Index: sem_ch5.adb
===================================================================
--- sem_ch5.adb	(revision 253567)
+++ sem_ch5.adb	(working copy)
@@ -141,72 +141,6 @@
       --  assignment statements that are really initializations. These are
       --  marked No_Ctrl_Actions.
 
-      function Should_Transform_BIP_Assignment
-        (Typ : Entity_Id) return Boolean
-      is
-         Result : Boolean;
-      begin
-         if Expander_Active
-           and then not Is_Limited_View (Typ)
-           and then Is_Build_In_Place_Result_Type (Typ)
-           and then not No_Ctrl_Actions (N)
-         then
-            --  This function is called early, before name resolution is
-            --  complete, so we have to deal with things that might turn into
-            --  function calls later. N_Function_Call and N_Op nodes are the
-            --  obvious case. An N_Identifier or N_Expanded_Name is a
-            --  parameterless function call if it denotes a function.
-            --  Finally, an attribute reference can be a function call.
-
-            case Nkind (Unqual_Conv (Rhs)) is
-               when N_Function_Call | N_Op =>
-                  Result := True;
-               when N_Identifier | N_Expanded_Name =>
-                  case Ekind (Entity (Unqual_Conv (Rhs))) is
-                     when E_Function | E_Operator =>
-                        Result := True;
-                     when others =>
-                        Result := False;
-                  end case;
-               when N_Attribute_Reference =>
-                  Result := Attribute_Name (Unqual_Conv (Rhs)) = Name_Input;
-                  --  T'Input will turn into a call whose result type is T
-               when others =>
-                  Result := False;
-            end case;
-         else
-            Result := False;
-         end if;
-         return Result;
-      end Should_Transform_BIP_Assignment;
-
-      procedure Transform_BIP_Assignment (Typ : Entity_Id) is
-         --  Tranform "X : [constant] T := F (...);" into:
-         --
-         --     Temp : constant T := F (...);
-         --     X := Temp;
-
-         Loc : constant Source_Ptr := Sloc (N);
-         Def_Id : constant Entity_Id := Make_Temporary (Loc, 'Y', Rhs);
-         Obj_Decl : constant Node_Id :=
-           Make_Object_Declaration
-             (Loc,
-              Defining_Identifier => Def_Id,
-              Constant_Present => True,
-              Object_Definition => New_Occurrence_Of (Typ, Loc),
-              Expression => Rhs,
-              Has_Init_Expression => True);
-      begin
-         Set_Etype (Def_Id, Typ);
-         Set_Expression (N, New_Occurrence_Of (Def_Id, Loc));
-
-         --  At this point, Rhs is no longer equal to Expression (N), so:
-
-         Rhs := Expression (N);
-
-         Insert_Action (N, Obj_Decl);
-      end Transform_BIP_Assignment;
-
       -------------------------------
       -- Diagnose_Non_Variable_Lhs --
       -------------------------------
@@ -314,6 +248,7 @@
          Opnd_Type : in out Entity_Id)
       is
          Decl : Node_Id;
+
       begin
          Require_Entity (Opnd);
 
@@ -331,9 +266,9 @@
                       or else
                         (Ekind (Entity (Opnd)) = E_Variable
                           and then Nkind (Parent (Entity (Opnd))) =
-                                            N_Object_Renaming_Declaration
+                                     N_Object_Renaming_Declaration
                           and then Nkind (Parent (Parent (Entity (Opnd)))) =
-                                            N_Accept_Statement))
+                                     N_Accept_Statement))
          then
             Opnd_Type := Get_Actual_Subtype (Opnd);
 
@@ -364,6 +299,93 @@
          end if;
       end Set_Assignment_Type;
 
+      -------------------------------------
+      -- Should_Transform_BIP_Assignment --
+      -------------------------------------
+
+      function Should_Transform_BIP_Assignment
+        (Typ : Entity_Id) return Boolean
+      is
+         Result : Boolean;
+
+      begin
+         if Expander_Active
+           and then not Is_Limited_View (Typ)
+           and then Is_Build_In_Place_Result_Type (Typ)
+           and then not No_Ctrl_Actions (N)
+         then
+            --  This function is called early, before name resolution is
+            --  complete, so we have to deal with things that might turn into
+            --  function calls later. N_Function_Call and N_Op nodes are the
+            --  obvious case. An N_Identifier or N_Expanded_Name is a
+            --  parameterless function call if it denotes a function.
+            --  Finally, an attribute reference can be a function call.
+
+            case Nkind (Unqual_Conv (Rhs)) is
+               when N_Function_Call
+                  | N_Op
+               =>
+                  Result := True;
+
+               when N_Expanded_Name
+                  | N_Identifier
+               =>
+                  case Ekind (Entity (Unqual_Conv (Rhs))) is
+                     when E_Function
+                        | E_Operator
+                     =>
+                        Result := True;
+
+                     when others =>
+                        Result := False;
+                  end case;
+
+               when N_Attribute_Reference =>
+                  Result := Attribute_Name (Unqual_Conv (Rhs)) = Name_Input;
+                  --  T'Input will turn into a call whose result type is T
+
+               when others =>
+                  Result := False;
+            end case;
+         else
+            Result := False;
+         end if;
+
+         return Result;
+      end Should_Transform_BIP_Assignment;
+
+      ------------------------------
+      -- Transform_BIP_Assignment --
+      ------------------------------
+
+      procedure Transform_BIP_Assignment (Typ : Entity_Id) is
+
+         --  Tranform "X : [constant] T := F (...);" into:
+         --
+         --     Temp : constant T := F (...);
+         --     X := Temp;
+
+         Loc      : constant Source_Ptr := Sloc (N);
+         Def_Id   : constant Entity_Id  := Make_Temporary (Loc, 'Y', Rhs);
+         Obj_Decl : constant Node_Id    :=
+                      Make_Object_Declaration (Loc,
+                        Defining_Identifier => Def_Id,
+                        Constant_Present    => True,
+                        Object_Definition   => New_Occurrence_Of (Typ, Loc),
+                        Expression          => Rhs,
+                        Has_Init_Expression => True);
+
+      begin
+         Set_Etype (Def_Id, Typ);
+         Set_Expression (N, New_Occurrence_Of (Def_Id, Loc));
+
+         --  At this point, Rhs is no longer equal to Expression (N), so:
+
+         Rhs := Expression (N);
+
+         Insert_Action (N, Obj_Decl);
+      end Transform_BIP_Assignment;
+
       --  Local variables
 
       T1 : Entity_Id;
@@ -524,13 +546,14 @@
          end if;
       end if;
 
-      --  Deal with build-in-place calls for nonlimited types.
-      --  We don't do this later, because resolving the rhs
-      --  tranforms it incorrectly for build-in-place.
+      --  Deal with build-in-place calls for nonlimited types. We don't do this
+      --  later, because resolving the rhs tranforms it incorrectly for build-
+      --  in-place.
 
       if Should_Transform_BIP_Assignment (Typ => T1) then
          Transform_BIP_Assignment (Typ => T1);
       end if;
+
       pragma Assert (not Should_Transform_BIP_Assignment (Typ => T1));
 
       --  The resulting assignment type is T1, so now we will resolve the left
@@ -538,8 +561,6 @@
 
       Resolve (Lhs, T1);
 
-      --  Cases where Lhs is not a variable
-
       --  Cases where Lhs is not a variable. In an instance or an inlined body
       --  no need for further check because assignment was legal in template.
 
@@ -1941,8 +1962,9 @@
             if Is_Array_Type (Typ)
               or else Is_Reversible_Iterator (Typ)
               or else
-                  (Present (Find_Aspect (Typ, Aspect_Iterable))
-                    and then Present
+                (Present (Find_Aspect (Typ, Aspect_Iterable))
+                  and then
+                    Present
                       (Get_Iterable_Type_Primitive (Typ, Name_Previous)))
             then
                null;
Index: sem_ch7.adb
===================================================================
--- sem_ch7.adb	(revision 253567)
+++ sem_ch7.adb	(working copy)
@@ -281,14 +281,6 @@
          --  If we haven't already traversed Node, then mark it and traverse
          --  it.
 
-         procedure Scan_Subprogram_Refs (Node : Node_Id) is
-         begin
-            if not Traversed_Table.Get (Node) then
-               Traversed_Table.Set (Node, True);
-               Traverse_And_Scan_Subprogram_Refs (Node);
-            end if;
-         end Scan_Subprogram_Refs;
-
          --------------------
          -- Has_Referencer --
          --------------------
@@ -533,6 +525,18 @@
             return OK;
          end Scan_Subprogram_Ref;
 
+         --------------------------
+         -- Scan_Subprogram_Refs --
+         --------------------------
+
+         procedure Scan_Subprogram_Refs (Node : Node_Id) is
+         begin
+            if not Traversed_Table.Get (Node) then
+               Traversed_Table.Set (Node, True);
+               Traverse_And_Scan_Subprogram_Refs (Node);
+            end if;
+         end Scan_Subprogram_Refs;
+
          --  Local variables
 
          Discard : Boolean;
Index: sem_util.adb
===================================================================
--- sem_util.adb	(revision 253567)
+++ sem_util.adb	(working copy)
@@ -7929,13 +7929,21 @@
 
             --  Special cases
 
-            --  Blocks, loops, and return statements have artificial scopes
+            --  Blocks carry either a source or an internally-generated scope,
+            --  unless the block is a byproduct of exception handling.
 
-            when N_Block_Statement
-               | N_Loop_Statement
-            =>
+            when N_Block_Statement =>
+               if not Exception_Junk (Par) then
+                  return Entity (Identifier (Par));
+               end if;
+
+            --  Loops carry an internally-generated scope
+
+            when N_Loop_Statement =>
                return Entity (Identifier (Par));
 
+            --  Extended return statements carry an internally-generated scope
+
             when N_Extended_Return_Statement =>
                return Return_Statement_Entity (Par);
 
@@ -19511,13 +19519,13 @@
          N := Next (Actual_Id);
 
          if Nkind (N) = N_Parameter_Association then
+
             --  In case of a build-in-place call, the call will no longer be a
             --  call; it will have been rewritten.
 
-            if Nkind_In (Parent (Actual_Id),
-                         N_Entry_Call_Statement,
-                         N_Function_Call,
-                         N_Procedure_Call_Statement)
+            if Nkind_In (Parent (Actual_Id), N_Entry_Call_Statement,
+                                             N_Function_Call,
+                                             N_Procedure_Call_Statement)
             then
                return First_Named_Actual (Parent (Actual_Id));
             else
@@ -23257,16 +23265,15 @@
          return "unknown subprogram";
       end if;
 
+      --  If the subprogram is a child unit, use its simple name to start the
+      --  construction of the fully qualified name.
+
       if Nkind (Ent) = N_Defining_Program_Unit_Name then
-
-         --  If the subprogram is a child unit, use its simple name to
-         --  start the construction of the fully qualified name.
-
          Append_Entity_Name (Buf, Defining_Identifier (Ent));
-
       else
          Append_Entity_Name (Buf, Ent);
       end if;
+
       return +Buf;
    end Subprogram_Name;
 
Index: sinfo.ads
===================================================================
--- sinfo.ads	(revision 253567)
+++ sinfo.ads	(working copy)
@@ -13009,7 +13009,7 @@
         5 => False),  --  SCIL_Tag_Value (Node5-Sem)
 
      N_Call_Marker =>
-       (1 => True,    --  Target (Node1-Sem)
+       (1 => False,   --  Target (Node1-Sem)
         2 => False,   --  unused
         3 => False,   --  unused
         4 => False,   --  unused
