exp_ch8.adb (Expand_N_Subprogram_Renaming_Declaration): If this is a renaming of...
authorEd Schonberg <schonberg@adacore.com>
Wed, 24 Apr 2013 13:10:01 +0000 (13:10 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 24 Apr 2013 13:10:01 +0000 (15:10 +0200)
2013-04-24  Ed Schonberg  <schonberg@adacore.com>

* exp_ch8.adb (Expand_N_Subprogram_Renaming_Declaration): If this
is a renaming of predefined equality for an untagged record,
add generated body to the freeze actions for the subprogram, to
prevent freezing issues when the record has incomplete components.
* exp_ch4.adb (Expand_Composite_Equality): If the type is a type
without completion, return a predefined comparison instead of
just False.  This may happen when building the expression for
record equality, when some component has a type whose completion
has not been seen yet. The operation will be analyzed an expanded
after the type has been frozen, at which point all component
types will have been completed, or an error reported.

2013-04-24  Ed Schonberg  <schonberg@adacore.com>

* sem_ch13.adb (Analyze_Aspect_Specifications): Do not delay
analysis of a Convention aspect.

From-SVN: r198225

gcc/ada/ChangeLog
gcc/ada/exp_ch4.adb
gcc/ada/exp_ch8.adb
gcc/ada/sem_ch13.adb

index b8f882d154287d13548cba273c0ec269063f02c5..5f29776f34488a43c179910786bb03e556d1e723 100644 (file)
@@ -1,3 +1,22 @@
+2013-04-24  Ed Schonberg  <schonberg@adacore.com>
+
+       * exp_ch8.adb (Expand_N_Subprogram_Renaming_Declaration): If this
+       is a renaming of predefined equality for an untagged record,
+       add generated body to the freeze actions for the subprogram, to
+       prevent freezing issues when the record has incomplete components.
+       * exp_ch4.adb (Expand_Composite_Equality): If the type is a type
+       without completion, return a predefined comparison instead of
+       just False.  This may happen when building the expression for
+       record equality, when some component has a type whose completion
+       has not been seen yet. The operation will be analyzed an expanded
+       after the type has been frozen, at which point all component
+       types will have been completed, or an error reported.
+
+2013-04-24  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch13.adb (Analyze_Aspect_Specifications): Do not delay
+       analysis of a Convention aspect.
+
 2013-04-24  Eric Botcazou  <ebotcazou@adacore.com>
 
        * fe.h (Machine_Overflows_On_Target): New macro and declaration.
index 76bf939898b765d964091a92422ef1c74adecfbf..e463f3868c8b04d08d3152f04a015962a40b9675 100644 (file)
@@ -2568,11 +2568,14 @@ package body Exp_Ch4 is
          Full_Type := Typ;
       end if;
 
-      --  Defense against malformed private types with no completion the error
-      --  will be diagnosed later by check_completion
+      --  If the private type has no completion the context may be the
+      --  expansion of a composite equality for a composite type with some
+      --  still incomplete components. The expression will not be analyzed
+      --  until the enclosing type is completed, at which point this will be
+      --  properly expanded, unless there is a bona fide completion error.
 
       if No (Full_Type) then
-         return New_Reference_To (Standard_False, Loc);
+         return Make_Op_Eq (Loc, Left_Opnd => Lhs, Right_Opnd => Rhs);
       end if;
 
       Full_Type := Base_Type (Full_Type);
index 3b5c7d3ae6466868692730a7855db0d824850c64..97bfac465391928cc9cfa493e70c6a1682ea8e76 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2012, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2013, 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- --
@@ -328,8 +328,8 @@ package body Exp_Ch8 is
                --  meaning. It may be redefined later, but the renaming is
                --  elaborated where it occurs. This is technically known as
                --  Squirreling semantics. Renaming is rewritten as a subprogram
-               --  declaration, and the body is inserted at the end of the
-               --  current declaration list to prevent premature freezing.
+               --  declaration, and the generated  body is inserted into the
+               --  freeze actions for the subprogram.
 
                Decl := Build_Body_For_Renaming;
 
@@ -345,7 +345,7 @@ package body Exp_Ch8 is
                             Rhs    => Make_Identifier (Loc, Chars (Right)),
                             Bodies => Declarations (Decl))))));
 
-               Append (Decl, List_Containing (N));
+               Append_Freeze_Action (Id, Decl);
             end if;
          end;
       end if;
index 40749addb0fac6bcd0989b64ab9416e113812f99..31f5ab826027207ea4bfd08b74c153a23e4ede1c 100644 (file)
@@ -1487,6 +1487,11 @@ package body Sem_Ch13 is
                      Make_Aitem_Pragma
                        (Pragma_Argument_Associations => Arg_List,
                         Pragma_Name                  => P_Name);
+
+                     --  Convention is a static name, and must be associated
+                     --  with the entity at once.
+
+                     Delay_Required := False;
                   end;
 
                --  CPU, Interrupt_Priority, Priority