Front-end layout must not be performed within a generic unit, because the
types therein will be recreated in an instance, and their characteristics are
partially unknown when analyzing a generic unit. Previously only generic types
themselves were excluded from layout determination.

Patch allows compilation of some run-time units when Fronend_Layout is true.

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

2012-02-22  Ed Schonberg  <schonb...@adacore.com>

        * freeze.adb (Freeze_Entity): Do not perform type layout within
        a generic unit.

Index: freeze.adb
===================================================================
--- freeze.adb  (revision 184470)
+++ freeze.adb  (working copy)
@@ -4407,10 +4407,12 @@
          --  the size and alignment values. This processing is not required for
          --  generic types, since generic types do not play any part in code
          --  generation, and so the size and alignment values for such types
-         --  are irrelevant.
+         --  are irrelevant. Ditto for types declared within a generic unit,
+         --  which may have components that depend on generic parameters, and
+         --  that will be recreated in an instance.
 
-         if Is_Generic_Type (E) then
-            return Result;
+         if Inside_A_Generic then
+            null;
 
          --  Otherwise we call the layout procedure
 

Reply via email to