summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/decl.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/import7.f9058
4 files changed, 70 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 99575797646..d39b7138d24 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-25 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/39688
+ * decl.c (gfc_match_import): Use 'sym->name' instead of 'name'.
+ They differ if the symbol has been use-renamed.
+
2009-04-24 Ian Lance Taylor <iant@google.com>
* gfortran.h (enum gfc_symbol_type): New named enum type, broken
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 1a8d6dcf36a..eaa310cf066 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -2741,7 +2741,7 @@ gfc_match_import (void)
goto next_item;
}
- st = gfc_new_symtree (&gfc_current_ns->sym_root, name);
+ st = gfc_new_symtree (&gfc_current_ns->sym_root, sym->name);
st->n.sym = sym;
sym->refs++;
sym->attr.imported = 1;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 654c5e8a9c0..af9f6bc632f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-25 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/39688
+ * gfortran.dg/import7.f90: New.
+
2009-04-24 Richard Guenther <rguenther@suse.de>
* gcc.dg/tree-ssa/vrp48.c: Fix.
diff --git a/gcc/testsuite/gfortran.dg/import7.f90 b/gcc/testsuite/gfortran.dg/import7.f90
new file mode 100644
index 00000000000..c115cc3f2b3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/import7.f90
@@ -0,0 +1,58 @@
+! { dg-do compile }
+!
+! PR39688: IMPORT of derived type fails
+!
+! Contributed by Bob Corbett <robert.corbett@sun.com>
+
+ MODULE MOD
+ TYPE T1
+ SEQUENCE
+ TYPE(T2), POINTER :: P
+ END TYPE
+ TYPE T2
+ SEQUENCE
+ INTEGER I
+ END TYPE
+ END
+
+ PROGRAM MAIN
+ USE MOD, T3 => T1, T4 => T2
+ TYPE T1
+ SEQUENCE
+ TYPE(T2), POINTER :: P
+ END TYPE
+ INTERFACE SUBR
+ SUBROUTINE SUBR1(X)
+ IMPORT T3
+ TYPE(T3) X
+ END SUBROUTINE
+ SUBROUTINE SUBR2(X)
+ IMPORT T1
+ TYPE(T1) X
+ END SUBROUTINE
+ END INTERFACE
+ TYPE T2
+ SEQUENCE
+ REAL X
+ END TYPE
+ END
+
+ SUBROUTINE SUBR1(X)
+ USE MOD
+ TYPE(T1) X
+ END
+
+ SUBROUTINE SUBR2(X)
+ TYPE T1
+ SEQUENCE
+ TYPE(T2), POINTER :: P
+ END TYPE
+ TYPE T2
+ SEQUENCE
+ REAL X
+ END TYPE
+ TYPE(T1) X
+ END
+
+! { dg-final { cleanup-modules "mod" } }
+