]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/29820 (ICE in fold_convert, at fold-const.c:2146)
authorPaul Thomas <pault@gcc.gnu.org>
Tue, 21 Nov 2006 23:42:17 +0000 (23:42 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Tue, 21 Nov 2006 23:42:17 +0000 (23:42 +0000)
2006-11-21 Paul Thomas  <pault@gcc.gnu.org>

PR fortran/29820
* trans-array.c (gfc_get_derived_type): Once done, spread the
backend_decl to all identical derived types in all sibling
namespaces.

2006-11-21 Paul Thomas  <pault@gcc.gnu.org>

PR fortran/29820
* gfortran.dg/used_types_13.f90: New test.

From-SVN: r119073

gcc/fortran/ChangeLog
gcc/fortran/trans-types.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/used_types_13.f90 [new file with mode: 0644]

index 4a30d00f9b7fc6c8f8a4dbabeab04fb4bea48805..bfc6d6db223c8fb8fc9ffe647b0515c812a13634 100644 (file)
@@ -1,3 +1,10 @@
+2006-11-21 Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/29820
+       * trans-array.c (gfc_get_derived_type): Once done, spread the
+       backend_decl to all identical derived types in all sibling
+       namespaces.
+
 2006-11-20  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/27546
index f0c41bb79922464110f12015cfe5f103c6f1962e..b1eeffcbbab9a4cd522e5d2d2882fdf584c5896e 100644 (file)
@@ -1608,11 +1608,8 @@ gfc_get_derived_type (gfc_symbol * derived)
 other_equal_dts:
   /* Add this backend_decl to all the other, equal derived types and
      their components in this and sibling namespaces.  */
-
-  for (dt = derived->ns->derived_types; dt; dt = dt->next)
-    copy_dt_decls_ifequal (derived, dt->derived);
-
-  for (ns = derived->ns->sibling; ns; ns = ns->sibling)
+  ns = derived->ns->parent ? derived->ns->parent->contained : derived->ns;
+  for (; ns; ns = ns->sibling)
     for (dt = ns->derived_types; dt; dt = dt->next)
       copy_dt_decls_ifequal (derived, dt->derived);
 
index fc8a3ed5bf1680525f4418ab4f4730a6c787f433..f4e5182233b2b843289631c1d5f4f7822b4fa3f4 100644 (file)
@@ -1,3 +1,8 @@
+2006-11-21 Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/29820
+       * gfortran.dg/used_types_13.f90: New test.
+
 2006-11-21  Janis Johnson  <janis187@us.ibm.com>
 
        * gcc.dg/dfp/snan.c: Delete.
diff --git a/gcc/testsuite/gfortran.dg/used_types_13.f90 b/gcc/testsuite/gfortran.dg/used_types_13.f90
new file mode 100644 (file)
index 0000000..9208b59
--- /dev/null
@@ -0,0 +1,28 @@
+! { dg-do compile }
+! Tests the fix for PR29820, which was another problem with derived type
+! association.  Not all siblings were being searched for identical types.
+!
+! Contributed by Harald Anlauf  <anlauf@gmx.de>
+!
+module geo
+  type geodetic
+     real :: h
+  end type geodetic
+end module geo
+module gfcbug44
+  implicit none
+contains
+subroutine point ( gp)
+  use geo
+  type(geodetic),  intent(out) :: gp
+  type(geodetic) :: gpx(1)
+  gp = gpx(1)
+end subroutine point
+subroutine plane ()
+  use geo
+  type(geodetic)  :: gp
+  call point ( gp)
+end subroutine plane
+end module gfcbug44
+! { dg-final { cleanup-modules "geo gfcbug44" } }
+