diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-22 19:12:46 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-22 19:12:46 +0000 |
commit | 52a22bc6fc302d2719365e4b75230ffc56075b4e (patch) | |
tree | 7f1fd3b2d30f16cac3db37da0ccba262810b28f0 | |
parent | 595a5656a11c75c4cda95ad95ac71bd06cac3781 (diff) | |
download | gcc-52a22bc6fc302d2719365e4b75230ffc56075b4e.tar.gz |
* gcc-interface/utils.c (gnat_types_compatible_p): Don't require strict
equality for the component type of array types.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162424 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ada/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/aggr15.adb | 18 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/aggr15.ads | 15 |
5 files changed, 50 insertions, 8 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d145b668a59..c80be7241a3 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +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-15 Nathan Froyd <froydnj@codesourcery.com> * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. @@ -7,10 +12,10 @@ 2010-07-13 Laurent GUERBY <laurent@guerby.net> - PR bootstrap/44458 - * gcc-interface/targtyps.c: Include tm_p.h. - * gcc-interface/Make-lang.in: Update dependencies. - + PR bootstrap/44458 + * gcc-interface/targtyps.c: Include tm_p.h. + * gcc-interface/Make-lang.in: Update dependencies. + 2010-07-09 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/trans.c (gnat_gimplify_expr) <ADDR_EXPR>: Deal with diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index de0d25c4841..eb65b7d2d4d 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -2080,17 +2080,17 @@ gnat_types_compatible_p (tree t1, tree t2) && 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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0e6e6f98b51..40ef493c162 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-07-22 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/aggr15.ad[sb]: New test. + 2010-07-22 Dodji Seketeli <dodji@redhat.com> PR debug/45024 diff --git a/gcc/testsuite/gnat.dg/aggr15.adb b/gcc/testsuite/gnat.dg/aggr15.adb new file mode 100644 index 00000000000..e69e9d346e1 --- /dev/null +++ b/gcc/testsuite/gnat.dg/aggr15.adb @@ -0,0 +1,18 @@ +-- { dg-do compile }
+-- { dg-options "-gnatws" }
+
+package body Aggr15 is
+
+ function CREATE return DATA_T is
+ D : DATA_T;
+ begin
+ return D;
+ end;
+
+ function ALL_CREATE return ALL_DATA_T is
+ C : constant ALL_DATA_T := (others => (others => Create));
+ begin
+ return C;
+ end;
+
+end Aggr15;
diff --git a/gcc/testsuite/gnat.dg/aggr15.ads b/gcc/testsuite/gnat.dg/aggr15.ads new file mode 100644 index 00000000000..23f26a8df7d --- /dev/null +++ b/gcc/testsuite/gnat.dg/aggr15.ads @@ -0,0 +1,15 @@ +package Aggr15 is
+
+ type T is tagged record
+ I : Integer;
+ end record;
+
+ type DATA_T is record
+ D : T;
+ end record;
+
+ type ALL_DATA_T is array (1..2, 1..2) of DATA_T;
+
+ function ALL_CREATE return ALL_DATA_T;
+
+end Aggr15;
|