OSDN Git Service

2007-04-13 Paul Thomas <pault@gcc.gnu.org>
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 13 Apr 2007 16:01:36 +0000 (16:01 +0000)
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 13 Apr 2007 16:01:36 +0000 (16:01 +0000)
PR fortran/31550
* trans-types.c (copy_dt_decls_ifequal): Do not get pointer
derived type components.

2007-04-13  Paul Thomas  <pault@gcc.gnu.org>

PR fortran/31550
* gfortran.dg/used_types_16.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123791 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 3079268..df60120 100644 (file)
@@ -1,3 +1,9 @@
+2007-04-13  Paul Thomas  <pault@gcc.gnu.org>\r
+\r
+       PR fortran/31550\r
+       * trans-types.c (copy_dt_decls_ifequal): Do not get pointer\r
+       derived type components.\r
+\r
 2007-04-13  Tobias Schlüter  <tobi@gcc.gnu.org>
 
        PR fortran/18937
index 24a3f3c..1462f33 100644 (file)
@@ -1446,7 +1446,7 @@ copy_dt_decls_ifequal (gfc_symbol *from, gfc_symbol *to)
   for (; to_cm; to_cm = to_cm->next, from_cm = from_cm->next)
     {
       to_cm->backend_decl = from_cm->backend_decl;
-      if (from_cm->ts.type == BT_DERIVED)
+      if (!from_cm->pointer && from_cm->ts.type == BT_DERIVED)
        gfc_get_derived_type (to_cm->ts.derived);
 
       else if (from_cm->ts.type == BT_CHARACTER)
index a22295a..04007bc 100644 (file)
@@ -1,3 +1,8 @@
+2007-04-13  Paul Thomas  <pault@gcc.gnu.org>\r
+\r
+       PR fortran/31550\r
+       * gfortran.dg/used_types_16.f90: New test.\r
+\r
 2007-04-13  Tobias Schlüter  <tobi@gcc.gnu.org>
 
        PR fortran/18937
diff --git a/gcc/testsuite/gfortran.dg/used_types_16.f90 b/gcc/testsuite/gfortran.dg/used_types_16.f90
new file mode 100644 (file)
index 0000000..b1ad779
--- /dev/null
@@ -0,0 +1,51 @@
+! { dg-do compile }
+! Tests the fix for PR31550 in which pointers to derived type components
+! were being TREE-SSA declared in the wrong order and so in the incorrect
+! context.
+!
+! Contributed by Daniel Franke <dfranke@gcc.gnu.org>
+!
+MODULE class_dummy_atom_types\r
+TYPE :: dummy_atom_list\r
+  TYPE(dummy_atom), DIMENSION(:), POINTER :: table\r
+  INTEGER                                 :: nused\r
+END TYPE\r
+\r
+TYPE :: dummy_atom\r
+  TYPE(dummy_atom_private), POINTER :: p\r
+END TYPE\r
+\r
+TYPE :: dummy_atom_private\r
+  TYPE(dummy_atom_list)       :: neighbours\r
+END TYPE\r
+END MODULE\r
+\r
+MODULE class_dummy_atom_list\r
+USE class_dummy_atom_types, ONLY: dummy_atom_list\r
+\r
+INTERFACE \r
+  SUBROUTINE dummy_atom_list_init_copy(this, other)\r
+    USE class_dummy_atom_types, ONLY: dummy_atom_list\r
+    TYPE(dummy_atom_list), INTENT(out) :: this\r
+    TYPE(dummy_atom_list), INTENT(in)  :: other\r
+  END SUBROUTINE\r
+END INTERFACE\r
+\r
+INTERFACE\r
+  SUBROUTINE dummy_atom_list_merge(this, other)\r
+    USE class_dummy_atom_types, ONLY: dummy_atom_list\r
+    TYPE(dummy_atom_list), INTENT(inout) :: this\r
+    TYPE(dummy_atom_list), INTENT(in)    :: other\r
+  END SUBROUTINE\r
+END INTERFACE\r
+END MODULE\r
+\r
+SUBROUTINE dummy_atom_list_init_copy(this, other)\r
+  USE class_dummy_atom_list, ONLY: dummy_atom_list, dummy_atom_list_merge\r
+\r
+  TYPE(dummy_atom_list), INTENT(out) :: this\r
+  TYPE(dummy_atom_list), INTENT(in)  :: other\r
+\r
+  this%table(1:this%nused) = other%table(1:other%nused)\r
+END SUBROUTINE\r
+! { dg-final { cleanup-modules "class_dummy_atom_types class_dummy_atom_list" } }