This patch does not change the behavior of native compilers. It
disables the frontend expansion of aggregates into assignments
when the type of the aggregate whose size is not known at compile time.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-08-03  Javier Miranda  <mira...@adacore.com>

        * exp_aggr.adb
        (Expand_Record_Aggregate): In VM targets disable the expansion into
        assignments of aggregates whose type is not known at compile time.

Index: exp_aggr.adb
===================================================================
--- exp_aggr.adb        (revision 177086)
+++ exp_aggr.adb        (working copy)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2010, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2011, 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- --
@@ -5649,7 +5649,9 @@
       --  Gigi doesn't handle properly temporaries of variable size
       --  so we generate it in the front-end
 
-      elsif not Size_Known_At_Compile_Time (Typ) then
+      elsif not Size_Known_At_Compile_Time (Typ)
+        and then Tagged_Type_Expansion
+      then
          Convert_To_Assignments (N, Typ);
 
       --  Temporaries for controlled aggregates need to be attached to a

Reply via email to