diff mbox

[Ada] Fix small elaboration regression

Message ID 201112111204.24234.ebotcazou@adacore.com
State New
Headers show

Commit Message

Eric Botcazou Dec. 11, 2011, 11:04 a.m. UTC
We now generate elaboration code to initialize an aggregate that contains a 
null access-to-unconstrained-array value.

Fixed thusly, tested on i586-suse-linux, applied on the mainline.


2011-12-11  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/utils2.c (gnat_build_constructor): Test the TREE_STATIC
	flag of elements to compute that of the constructor.


2011-12-11  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/specs/elab3.ads: New test.
diff mbox

Patch

Index: gcc-interface/utils2.c
===================================================================
--- gcc-interface/utils2.c	(revision 182102)
+++ gcc-interface/utils2.c	(working copy)
@@ -1817,7 +1817,7 @@  gnat_build_constructor (tree type, VEC(c
   FOR_EACH_CONSTRUCTOR_ELT (v, n_elmts, obj, val)
     {
       /* The predicate must be in keeping with output_constructor.  */
-      if (!TREE_CONSTANT (val)
+      if ((!TREE_CONSTANT (val) && !TREE_STATIC (val))
 	  || (TREE_CODE (type) == RECORD_TYPE
 	      && CONSTRUCTOR_BITFIELD_P (obj)
 	      && !initializer_constant_valid_for_bitfield_p (val))