diff mbox

[Ada] Fix ICE on qualified aggregate of array type

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

Commit Message

Eric Botcazou April 2, 2011, 9:37 a.m. UTC
The compiler aborts on the initialization of an access object to unconstrained 
array type with an allocator whose initializer is a qualified aggregate (with 
a constrained subtype of the array type), if the array type has an alignment 
clause that causes it to be more aligned than its component type.

Fixed by removing old code. Tested on i586-suse-linux, applied on the mainline.


2011-04-02  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/utils2.c (build_allocator): In the unconstrained array
	type case, do not strip a padding type around the array type.


2011-04-02  Eric Botcazou  <ebotcazou@adacore.com>

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

Patch

Index: gcc-interface/utils2.c
===================================================================
--- gcc-interface/utils2.c	(revision 171818)
+++ gcc-interface/utils2.c	(working copy)
@@ -2135,17 +2135,9 @@  build_allocator (tree type, tree init, t
 					  gnat_proc, gnat_pool, gnat_node);
       storage = convert (storage_ptr_type, gnat_protect_expr (storage));
 
-      if (TYPE_IS_PADDING_P (type))
-	{
-	  type = TREE_TYPE (TYPE_FIELDS (type));
-	  if (init)
-	    init = convert (type, init);
-	}
-
-      /* If there is an initializing expression, make a constructor for
-	 the entire object including the bounds and copy it into the
-	 object.  If there is no initializing expression, just set the
-	 bounds.  */
+      /* If there is an initializing expression, then make a constructor for
+	 the entire object including the bounds and copy it into the object.
+	 If there is no initializing expression, just set the bounds.  */
       if (init)
 	{
 	  VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 2);
@@ -2154,7 +2146,6 @@  build_allocator (tree type, tree init, t
 				  build_template (template_type, type, init));
 	  CONSTRUCTOR_APPEND_ELT (v, DECL_CHAIN (TYPE_FIELDS (storage_type)),
 				  init);
-
 	  return convert
 	    (result_type,
 	     build2 (COMPOUND_EXPR, storage_ptr_type,