From: Eric Botcazou Date: Thu, 22 Jul 2010 19:12:46 +0000 (+0000) Subject: utils.c (gnat_types_compatible_p): Don't require strict equality for the component... X-Git-Tag: releases/gcc-4.6.0~5502 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cfa0bd19c5187edf728c1ca985b1c8ee7a477c73;p=thirdparty%2Fgcc.git utils.c (gnat_types_compatible_p): Don't require strict equality for the component type of array types. * gcc-interface/utils.c (gnat_types_compatible_p): Don't require strict equality for the component type of array types. From-SVN: r162424 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d145b668a596..c80be7241a34 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2010-07-22 Eric Botcazou + + * 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 * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. @@ -7,10 +12,10 @@ 2010-07-13 Laurent GUERBY - 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 * gcc-interface/trans.c (gnat_gimplify_expr) : Deal with diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index de0d25c4841e..eb65b7d2d4dd 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 0e6e6f98b51d..40ef493c162d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-07-22 Eric Botcazou + + * gnat.dg/aggr15.ad[sb]: New test. + 2010-07-22 Dodji Seketeli PR debug/45024 diff --git a/gcc/testsuite/gnat.dg/aggr15.adb b/gcc/testsuite/gnat.dg/aggr15.adb new file mode 100644 index 000000000000..e69e9d346e10 --- /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 000000000000..23f26a8df7dd --- /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;