[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 21 Apr 2016 08:30:19 +0000 (10:30 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 21 Apr 2016 08:30:19 +0000 (10:30 +0200)
2016-04-21  Gary Dismukes  <dismukes@adacore.com>

* exp_attr.adb (Is_Inline_Floating_Point_Attribute): Suppress
expansion of Attribute_Machine and Attribute_Model for AAMP.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

* freeze.adb: Disable previous change for now.

2016-04-21  Ed Schonberg  <schonberg@adacore.com>

* sem_ch8.adb (Find_Selected_Component): If prefix has an
access type and designated type is a limited view, introduce
an explicit dereference before continuing the analysis, and
set its type to the non-limited view of the designated type,
if we are in context where it is available.

From-SVN: r235311

gcc/ada/ChangeLog
gcc/ada/exp_attr.adb
gcc/ada/freeze.adb
gcc/ada/sem_ch8.adb

index 067ba8fb6dbc981f1ac1dddf3774125a08618554..d0cc96ae9cab88ce960acc6eacd132a7f6c42dc6 100644 (file)
@@ -1,3 +1,20 @@
+2016-04-21  Gary Dismukes  <dismukes@adacore.com>
+
+       * exp_attr.adb (Is_Inline_Floating_Point_Attribute): Suppress
+       expansion of Attribute_Machine and Attribute_Model for AAMP.
+
+2016-04-21  Ed Schonberg  <schonberg@adacore.com>
+
+       * freeze.adb: Disable previous change for now.
+
+2016-04-21  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch8.adb (Find_Selected_Component): If prefix has an
+       access type and designated type is a limited view, introduce
+       an explicit dereference before continuing the analysis, and
+       set its type to the non-limited view of the designated type,
+       if we are in context where it is available.
+
 2016-04-21  Ed Schonberg  <schonberg@adacore.com>
 
        * freeze.adb: Freeze profile in ASIS mode.
index cfbba77558066baf817df5e7b9db051ff80446ea..28e1f65f646903bf7f0dcf866b468705f87546de 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2015, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2016, 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- --
@@ -7993,13 +7993,13 @@ package body Exp_Attr is
            and then not Generate_C_Code;
       end Is_GCC_Target;
 
-   --  Start of processing for Exp_Attr
+   --  Start of processing for Is_Inline_Floating_Point_Attribute
 
    begin
-      --  Machine and Model can be expanded by the GCC backend only
+      --  Machine and Model can be expanded by the GCC and AAMP back ends only
 
       if Id = Attribute_Machine or else Id = Attribute_Model then
-         return Is_GCC_Target;
+         return Is_GCC_Target or else AAMP_On_Target;
 
       --  Remaining cases handled by all back ends are Rounding and Truncation
       --  when appearing as the operand of a conversion to some integer type.
index 2f6ab82eb80c5cb077defde377ffae2af0308309..ba95f269c598dd82ad434e1c0e4aee0f0a7d91c5 100644 (file)
@@ -5008,11 +5008,13 @@ package body Freeze is
             --  Other constructs that should not freeze ???
 
             --  This processing doesn't apply to internal entities (see below)
-            --  In ASIS mode the profile is frozen unconditionally, to prevent
-            --  backend anomalies.
+
+            --  Disable this mechanism for now, to fix regressions in ASIS and
+            --  various ACATS tests. Implementation of AI05-019 remains
+            --  unsolved ???
 
             if not Is_Internal (E)
-              and then (Do_Freeze_Profile or ASIS_Mode)
+              and then (Do_Freeze_Profile or else True)
             then
                if not Freeze_Profile (E) then
                   Ghost_Mode := Save_Ghost_Mode;
index 73303f49f1215a58d2a1aa747b79b808a73d45f8..842bb23a2f5e1510ff0138f6c23ddf7ec4c65ec3 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2015, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2016, 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- --
@@ -6729,17 +6729,27 @@ package body Sem_Ch8 is
 
          --  The designated type may be a limited view with no components.
          --  Check whether the non-limited view is available, because in some
-         --  cases this will not be set when installing the context.
+         --  cases this will not be set when installing the context. Rewrite
+         --  the node by introducing an explicit dereference at once, and
+         --  setting the type of the rewritten prefix to the non-limited view
+         --  of the original designated type.
 
          if Is_Access_Type (P_Type) then
             declare
-               D : constant Entity_Id := Directly_Designated_Type (P_Type);
+               Desig_Typ : constant Entity_Id :=
+                             Directly_Designated_Type (P_Type);
+
             begin
-               if Is_Incomplete_Type (D)
-                 and then From_Limited_With (D)
-                 and then Present (Non_Limited_View (D))
+               if Is_Incomplete_Type (Desig_Typ)
+                 and then From_Limited_With (Desig_Typ)
+                 and then Present (Non_Limited_View (Desig_Typ))
                then
-                  Set_Directly_Designated_Type (P_Type,  Non_Limited_View (D));
+                  Rewrite (P,
+                    Make_Explicit_Dereference (Sloc (P),
+                      Prefix => Relocate_Node (P)));
+
+                  Set_Etype (P, Get_Full_View (Non_Limited_View (Desig_Typ)));
+                  P_Type := Etype (P);
                end if;
             end;
          end if;
@@ -6930,9 +6940,19 @@ package body Sem_Ch8 is
          else
             --  Format node as expanded name, to avoid cascaded errors
 
+            --  If the limited_with transformation was applied earlier,
+            --  restore source for proper error reporting.
+
+            if not Comes_From_Source (P)
+              and then Nkind (P) = N_Explicit_Dereference
+            then
+               Rewrite (P, Prefix (P));
+               P_Type := Etype (P);
+            end if;
+
             Change_Selected_Component_To_Expanded_Name (N);
-            Set_Entity  (N, Any_Id);
-            Set_Etype   (N, Any_Type);
+            Set_Entity (N, Any_Id);
+            Set_Etype  (N, Any_Type);
 
             --  Issue error message, but avoid this if error issued already.
             --  Use identifier of prefix if one is available.