summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-28 08:44:29 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-28 08:44:29 +0000
commitfbe77c753903c24f81735a3458d04fa07f0f6f18 (patch)
treef9566bf437c85c13c282f43e0684b3744d59c095
parent6b0e9e4b5c5b235331d464a3f1d8549ca82a1054 (diff)
downloadgcc-fbe77c753903c24f81735a3458d04fa07f0f6f18.tar.gz
2010-07-28 Tobias Burnus <burnus@net-b.de>
PR fortran/45077 * trans-types.c (gfc_get_derived_type): Fix DT declaration from modules for whole-file mode. 2010-07-28 Tobias Burnus <burnus@net-b.de> PR fortran/45077 * gfortran.dg/whole_file_24.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162619 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-types.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_24.f9035
4 files changed, 49 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index fb49a8dc85b..e0b73740234 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2010-07-28 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/45077
+ * trans-types.c (gfc_get_derived_type): Fix DT declaration
+ from modules for whole-file mode.
+
2010-07-27 Joseph Myers <joseph@codesourcery.com>
* gfortran.h (gfc_handle_option): Update prototype and return
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 62b298c213b..b532788365a 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -1994,8 +1994,10 @@ gfc_get_derived_type (gfc_symbol * derived)
gfc_symbol *s;
s = NULL;
gfc_find_symbol (derived->name, gsym->ns, 0, &s);
- if (s && s->backend_decl)
+ if (s)
{
+ if (!s->backend_decl)
+ s->backend_decl = gfc_get_derived_type (s);
gfc_copy_dt_decls_ifequal (s, derived, true);
goto copy_derived_types;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7a1a1759bab..57b6a296927 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-07-28 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/45077
+ * gfortran.dg/whole_file_24.f90: New.
+
2010-07-27 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/variadic102.C: New.
diff --git a/gcc/testsuite/gfortran.dg/whole_file_24.f90 b/gcc/testsuite/gfortran.dg/whole_file_24.f90
new file mode 100644
index 00000000000..4ac11cce2fd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/whole_file_24.f90
@@ -0,0 +1,35 @@
+! { dg-do compile }
+!
+! PR fortran/45077
+!
+! Contributed by Dominique d'Humieres, based on a test
+! case of Juergen Reuter.
+!
+
+module iso_red
+ type, public :: varying_string
+ character(LEN=1), dimension(:), allocatable :: chars
+ end type varying_string
+end module iso_red
+
+module ifiles
+ use iso_red, string_t => varying_string
+contains
+ function line_get_string_advance (line) result (string)
+ type(string_t) :: string
+ character :: line
+ end function line_get_string_advance
+end module ifiles
+
+module syntax_rules
+ use iso_red, string_t => varying_string
+ use ifiles, only: line_get_string_advance
+contains
+ subroutine syntax_init_from_ifile ()
+ type(string_t) :: string
+ string = line_get_string_advance ("")
+ end subroutine syntax_init_from_ifile
+end module syntax_rules
+end
+
+! { dg-final { cleanup-modules "iso_red ifiles syntax_rules" } }