+2012-07-17  Robert Dewar  <dewar@adacore.com>
+
+       * s-assert.ads: Fix comments to make it clear that this is used
+       for all assertions, not just pragma Assert.
+
+2012-07-17  Jerome Guitton  <guitton@adacore.com>
+
+       * par_sco.ads: Minor typo fix.
+
+2012-07-17  Gary Dismukes  <dismukes@adacore.com>
+
+       * layout.adb (Layout_Type): In the case where the target is
+       AAMP, use 32 bits (a single pointer) rather than 64 bits for an
+       anonymous access-to-subprogram type if the type is library-level
+       and Is_Local_Anonymous_Access is True.
+
+2012-07-17  Jose Ruiz  <ruiz@adacore.com>
+
+       * s-tassta.adb, s-tarest.adb (Create_Task, Create_Restricted_Task,
+       Initialize): Add comments explaining that the CPU affinity value that
+       is passed to the run-time library can be either Unspecified_CPU, to
+       indicate that the task inherits the affinity of its activating task,
+       or a value in the range of CPU_Range but no greater than Number_Of_CPUs.
+
+2012-07-17  Javier Miranda  <miranda@adacore.com>
+
+       * exp_disp.adb (Make_DT): Remove decoration of Ada.Tags entities.
+       (Make_Tags): Add decoration of Ada.Tags entities.
+
+2012-07-17  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch6.adb (Check_Statement_Sequence): When locating the
+       last significant statement in a sequence, ignore iserted nodes
+       that typically come from expansion of controlled operations.
+
+2012-07-17  Tristan Gingold  <gingold@adacore.com>
+
+       * gnat_rm.texi: Document foreign exceptions.
+
 2012-07-17  Robert Dewar  <dewar@adacore.com>
 
        * sem_prag.adb, treepr.ads: Minor reformatting.
        * seh_init.c (__gnat_SEH_error_handler): Not compiled anymore
        on Windows 64 (+ SEH), as it is unused.
 
-2012-07-17  Tristan Gingold  <gingold@adacore.com>
-
-       * treepr.ads (psloc): Declare.
-       * treepr.adb (psloc): New debug procedure to print a sloc.
-       (Print_Sloc): New procedure, from ...
-       (Print_Node_Subtree): ... this.  Call Print_Sloc.
-
 2012-07-17  Javier Miranda  <miranda@adacore.com>
 
        * sem_prag.adb (CPP_Class): Transform obsolescent pragma CPP_Class into
 
             Elmt : Elmt_Id;
 
          begin
-            --  Ensure that entities Prim_Ptr and Predef_Prims_Table_Ptr have
-            --  the decoration required by the backend
-
-            Set_Is_Dispatch_Table_Entity (RTE (RE_Prim_Ptr));
-            Set_Is_Dispatch_Table_Entity (RTE (RE_Predef_Prims_Table_Ptr));
-
             --  Object declarations
 
             Elmt := First_Elmt (DT_Decl);
       Set_Ekind        (DT_Ptr, E_Variable);
       Set_Related_Type (DT_Ptr, Typ);
 
+      --  Ensure that entities Prim_Ptr and Predef_Prims_Table_Ptr have
+      --  the decoration required by the backend
+
+      Set_Is_Dispatch_Table_Entity (RTE (RE_Prim_Ptr));
+      Set_Is_Dispatch_Table_Entity (RTE (RE_Predef_Prims_Table_Ptr));
+
       --  For CPP types there is no need to build the dispatch tables since
       --  they are imported from the C++ side. If the CPP type has an IP then
       --  we declare now the variable that will store the copy of the C++ tag.
 
 limited if not explicitly declared as limited or derived from a limited
 type, and an error is issued in that case.
 
-Pragma @code{CPP_Class} is intended primarily for automatic generation
-using an automatic binding generator tool.
 See @ref{Interfacing to C++} for related information.
 
 Note: Pragma @code{CPP_Class} is currently obsolete. It is supported
 on the Ada side and the type is implicitly declared abstract.
 
 Pragma @code{CPP_Constructor} is intended primarily for automatic generation
-using an automatic binding generator tool.
+using an automatic binding generator tool (such as the @code{-fdump-ada-spec}
+GCC switch).
 See @ref{Interfacing to C++} for more related information.
 
 Note: The use of functions returning class-wide types for constructors is
 @noindent
 The interface to C++ makes use of the following pragmas, which are
 primarily intended to be constructed automatically using a binding generator
-tool, although it is possible to construct them by hand.  No suitable binding
-generator tool is supplied with GNAT though.
+tool, although it is possible to construct them by hand.
 
 Using these pragmas it is possible to achieve complete
 inter-operability between Ada tagged types and C++ class definitions.
 with pragma @code{Import}) as corresponding to a C++ constructor.
 @end table
 
+In addition, C++ exceptions are propagated and can be handled in a
+@code{others} choice of an exception handler. The corresponding Ada
+occurrence has no message, and the simple name of the exception identity
+contains @samp{Foreign_Exception}.
+
 @node Interfacing to COBOL
 @section Interfacing to COBOL
 
 
             Init_Size (E, 2 * System_Address_Size);
 
          --  When the target is AAMP, access-to-subprogram types are fat
-         --  pointers consisting of the subprogram address and a static link
-         --  (with the exception of library-level access types, where a simple
-         --  subprogram address is used).
+         --  pointers consisting of the subprogram address and a static link,
+         --  with the exception of library-level access types (including
+         --  library-level anonymous access types, such as for components),
+         --  where a simple subprogram address is used.
 
          elsif AAMP_On_Target
            and then
-             (Ekind (E) = E_Anonymous_Access_Subprogram_Type
-               or else (Ekind (E) = E_Access_Subprogram_Type
-                         and then Present (Enclosing_Subprogram (E))))
+             ((Ekind (E) = E_Access_Subprogram_Type
+                and then Present (Enclosing_Subprogram (E)))
+                  or else
+                    (Ekind (E) = E_Anonymous_Access_Subprogram_Type
+                      and then
+                        (not Is_Local_Anonymous_Access (E)
+                          or else Present (Enclosing_Subprogram (E)))))
          then
             Init_Size (E, 2 * System_Address_Size);
 
 
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2009-2011, Free Software Foundation, Inc.         --
+--          Copyright (C) 2009-2012, 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- --
 ------------------------------------------------------------------------------
 
 --  This package contains the routines used to deal with generation and output
---  of Soure Coverage Obligations (SCO's) used for coverage analysis purposes.
+--  of Source Coverage Obligations (SCO's) used for coverage analysis purposes.
 --  See package SCOs for full documentation of format of SCO information.
 
 with Types; use Types;
 
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2012, 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- --
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  This package provides support for the GNAT assert pragma
+--  This package provides support for assertions (including pragma Assert,
+--  pragma Debug, and Precondition/Postcondition/Predicate/Invariant aspects
+--  and their corresponding pragmas).
 
 --  This unit may be used directly from an application program by providing
 --  an appropriate WITH, and the interface can be expected to remain stable.
 
 --                                                                          --
 --                                  B o d y                                 --
 --                                                                          --
---         Copyright (C) 1999-2011, Free Software Foundation, Inc.          --
+--         Copyright (C) 1999-2012, Free Software Foundation, Inc.          --
 --                                                                          --
 -- GNARL 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- --
          then Self_ID.Common.Base_Priority
          else System.Any_Priority (Priority));
 
+      --  Legal values of CPU are the special Unspecified_CPU value which is
+      --  inserted by the compiler for tasks without CPU aspect, and those in
+      --  the range of CPU_Range but no greater than Number_Of_CPUs. Otherwise
+      --  the task is defined to have failed, and it becomes a completed task
+      --  (RM D.16(14/3)).
+
       if CPU /= Unspecified_CPU
         and then (CPU < Integer (System.Multiprocessors.CPU_Range'First)
           or else CPU > Integer (System.Multiprocessors.CPU_Range'Last)
 
       --  Normal CPU affinity
       else
+         --  When the application code says nothing about the task affinity
+         --  (task without CPU aspect) then the compiler inserts the
+         --  Unspecified_CPU value which indicates to the run-time library that
+         --  the task will activate and execute on the same processor as its
+         --  activating task if the activating task is assigned a processor
+         --  (RM D.16(14/3)).
+
          Base_CPU :=
            (if CPU = Unspecified_CPU
             then Self_ID.Common.Base_CPU
 
 --                                                                          --
 --                                  B o d y                                 --
 --                                                                          --
---         Copyright (C) 1992-2011, Free Software Foundation, Inc.          --
+--         Copyright (C) 1992-2012, Free Software Foundation, Inc.          --
 --                                                                          --
 -- GNARL 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- --
          then Self_ID.Common.Base_Priority
          else System.Any_Priority (Priority));
 
+      --  Legal values of CPU are the special Unspecified_CPU value which is
+      --  inserted by the compiler for tasks without CPU aspect, and those in
+      --  the range of CPU_Range but no greater than Number_Of_CPUs. Otherwise
+      --  the task is defined to have failed, and it becomes a completed task
+      --  (RM D.16(14/3)).
+
       if CPU /= Unspecified_CPU
         and then (CPU < Integer (System.Multiprocessors.CPU_Range'First)
                     or else
       --  Normal CPU affinity
 
       else
+         --  When the application code says nothing about the task affinity
+         --  (task without CPU aspect) then the compiler inserts the
+         --  Unspecified_CPU value which indicates to the run-time library that
+         --  the task will activate and execute on the same processor as its
+         --  activating task if the activating task is assigned a processor
+         --  (RM D.16(14/3)).
+
          Base_CPU :=
            (if CPU = Unspecified_CPU
             then Self_ID.Common.Base_CPU
 
                 and then Exception_Junk (Last_Stm))
            or else Nkind (Last_Stm) in N_Push_xxx_Label
            or else Nkind (Last_Stm) in N_Pop_xxx_Label
+
+         --  Inserted code, such as finalization calls, is irrelevant: we only
+         --  need to check original source.
+
+           or else Is_Rewrite_Insertion (Last_Stm)
          loop
             Prev (Last_Stm);
          end loop;
 
    --  level and the bars used to link list elements). In addition, for lines
    --  other than the first, an additional character Prefix_Char is output.
 
-   procedure Print_Sloc (Loc : Source_Ptr);
-   --  Print the human readable representation of Loc
-
    function Serial_Number (Id : Int) return Nat;
    --  Given a Node_Id, List_Id or Elist_Id, returns the previously assigned
    --  serial number, or zero if no serial number has yet been assigned.
       Field_To_Be_Printed : Boolean;
       Prefix_Str_Char     : String (Prefix_Str'First .. Prefix_Str'Last + 1);
 
+      Sfile : Source_File_Index;
       Fmt   : UI_Format;
 
    begin
          Print_Str (Prefix_Str_Char);
          Print_Str ("Sloc = ");
 
-         Print_Sloc (Sloc (N));
+         if Sloc (N) = Standard_Location then
+            Print_Str ("Standard_Location");
+
+         elsif Sloc (N) = Standard_ASCII_Location then
+            Print_Str ("Standard_ASCII_Location");
+
+         else
+            Sfile := Get_Source_File_Index (Sloc (N));
+            Print_Int (Int (Sloc (N)) - Int (Source_Text (Sfile)'First));
+            Write_Str ("  ");
+            Write_Location (Sloc (N));
+         end if;
+
+         Print_Eol;
       end if;
 
       --  Print Chars field if present
       Print_Term;
    end Print_Node_Subtree;
 
-   ----------------
-   -- Print_Sloc --
-   ----------------
-
-   procedure Print_Sloc (Loc : Source_Ptr) is
-      Sfile : Source_File_Index;
-
-   begin
-      if Loc = Standard_Location then
-         Print_Str ("Standard_Location");
-
-      elsif Loc = Standard_ASCII_Location then
-         Print_Str ("Standard_ASCII_Location");
-
-      else
-         Sfile := Get_Source_File_Index (Loc);
-         Print_Int (Int (Loc) - Int (Source_Text (Sfile)'First));
-         Write_Str ("  ");
-         Write_Location (Loc);
-      end if;
-
-      Print_Eol;
-   end Print_Sloc;
-
    ---------------
    -- Print_Str --
    ---------------
       Print_Node (N, Label, ' ');
    end Print_Tree_Node;
 
-   -----------
-   -- psloc --
-   -----------
-
-   procedure psloc (Loc : Source_Ptr) is
-   begin
-      Phase := Printing;
-      Print_Sloc (Loc);
-   end psloc;
-
    --------
    -- pt --
    --------
 
    pragma Export (Ada, ppp);
    --  Same as Print_Node_Subtree
 
-   procedure psloc (Loc : Source_Ptr);
-   pragma Export (Ada, psloc);
-   --  Prints the sloc Loc
-   --  Why is this here??? use the routines in Sprint instead ???
-
    --  The following are no longer needed; you can use pp or ppp instead
 
    procedure pe (E : Elist_Id);