Patchwork [Ada] Fix ICE on aggregate of multidimensional array type

login
register
mail settings
Submitter Eric Botcazou
Date July 22, 2010, 7:13 p.m.
Message ID <201007222113.10089.ebotcazou@adacore.com>
Download mbox | patch
Permalink /patch/59631/
State New
Headers show

Comments

Eric Botcazou - July 22, 2010, 7:13 p.m.
This was a latent problem, now exposed thanks to improved internal checks.
The compiler aborts when trying to create a temporary of an addressable type, 
because of a VIEW_CONVERT_EXPR created in a formal conversion.

Tested on i586-suse-linux, applied on the mainline.


2010-07-22  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/utils.c (gnat_types_compatible_p): Don't require strict
	equality for the component type of array types.


2010-07-22  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/aggr15.ad[sb]: New test.


--
Eric Botcazou

Patch

Index: gcc-interface/utils.c
===================================================================
--- gcc-interface/utils.c	(revision 162313)
+++ gcc-interface/utils.c	(working copy)
@@ -2080,17 +2080,17 @@  gnat_types_compatible_p (tree t1, tree t
       && TYPE_PRECISION (TREE_TYPE (t1)) == TYPE_PRECISION (TREE_TYPE (t2)))
     return 1;
 
-  /* Array types are also compatible if they are constrained and have
-     the same component type and the same domain.  */
+  /* Array types are also compatible if they are constrained and have the same
+     domain and compatible component types.  */
   if (code == ARRAY_TYPE
-      && TREE_TYPE (t1) == TREE_TYPE (t2)
       && (TYPE_DOMAIN (t1) == TYPE_DOMAIN (t2)
 	  || (TYPE_DOMAIN (t1)
 	      && TYPE_DOMAIN (t2)
 	      && tree_int_cst_equal (TYPE_MIN_VALUE (TYPE_DOMAIN (t1)),
 				     TYPE_MIN_VALUE (TYPE_DOMAIN (t2)))
 	      && tree_int_cst_equal (TYPE_MAX_VALUE (TYPE_DOMAIN (t1)),
-				     TYPE_MAX_VALUE (TYPE_DOMAIN (t2))))))
+				     TYPE_MAX_VALUE (TYPE_DOMAIN (t2)))))
+      && gnat_types_compatible_p (TREE_TYPE (t1), TREE_TYPE (t2)))
     return 1;
 
   /* Padding record types are also compatible if they pad the same