diff options
author | Tobias Burnus <burnus@net-b.de> | 2013-01-28 15:37:20 +0100 |
---|---|---|
committer | Mikael Morin <mikael@gcc.gnu.org> | 2013-01-28 14:37:20 +0000 |
commit | dd8b9ddea2288c96124367bf66ce060eb1049872 (patch) | |
tree | 46bdc06e6d37edaa05bcf617578ec98dd1195a09 /gcc/testsuite | |
parent | e63f158158a16d77dd34492534e13c1a5ca27943 (diff) | |
download | gcc-dd8b9ddea2288c96124367bf66ce060eb1049872.zip gcc-dd8b9ddea2288c96124367bf66ce060eb1049872.tar.gz gcc-dd8b9ddea2288c96124367bf66ce060eb1049872.tar.bz2 |
re PR fortran/53537 (Explicit IMPORT of renamed USE-associated symbol fails)
2013-01-28 Tobias Burnus <burnus@net-b.de>
Mikael Morin <mikael@gcc.gnu.org>
PR fortran/53537
* symbol.c (gfc_find_sym_tree): Don't look for the symbol outside an
interface block.
(gfc_get_ha_symtree): Let gfc_find_sym_tree lookup the parent namespace.
* decl.c (gfc_match_data_decl): Ditto.
(variable_decl): Remove undeclared type error.
(gfc_match_import): Use renamed instead of original name.
2013-01-28 Tobias Burnus <burnus@net-b.de>
Mikael Morin <mikael@gcc.gnu.org>
PR fortran/53537
* gfortran.dg/import2.f90: Adjust undeclared type error messages.
* gfortran.dg/import8.f90: Likewise.
* gfortran.dg/interface_derived_type_1.f90: Likewise.
* gfortran.dg/import10.f90: New test.
* gfortran.dg/import11.f90: Likewise
Co-Authored-By: Mikael Morin <mikael@gcc.gnu.org>
From-SVN: r195506
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/import10.f90 | 24 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/import11.f90 | 28 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/import2.f90 | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/import8.f90 | 2 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/interface_derived_type_1.f90 | 2 |
6 files changed, 67 insertions, 5 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b9d16f23..b35c132 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2013-01-28 Tobias Burnus <burnus@net-b.de> + Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/53537 + * gfortran.dg/import2.f90: Adjust undeclared type error messages. + * gfortran.dg/import8.f90: Likewise. + * gfortran.dg/interface_derived_type_1.f90: Likewise. + * gfortran.dg/import10.f90: New test. + * gfortran.dg/import11.f90: Likewise + 2013-01-28 Jakub Jelinek <jakub@redhat.com> PR testsuite/56053 diff --git a/gcc/testsuite/gfortran.dg/import10.f90 b/gcc/testsuite/gfortran.dg/import10.f90 new file mode 100644 index 0000000..dbe630a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/import10.f90 @@ -0,0 +1,24 @@ +! { dg-do compile } +! +! PR fortran/53537 +! The use of WP in the ODE_DERIVATIVE interface used to be rejected because +! the symbol was imported under the original name DP. +! +! Original test case from Arjen Markus <arjen.markus@deltares.nl> + +module select_precision + integer, parameter :: dp = kind(1.0) +end module select_precision + +module ode_types + use select_precision, only: wp => dp + implicit none + interface + subroutine ode_derivative(x) + import :: wp + real(wp) :: x + end subroutine ode_derivative + end interface +end module ode_types + + diff --git a/gcc/testsuite/gfortran.dg/import11.f90 b/gcc/testsuite/gfortran.dg/import11.f90 new file mode 100644 index 0000000..f2ac514 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/import11.f90 @@ -0,0 +1,28 @@ +! { dg-do compile } +! +! PR fortran/53537 +! The definition of T1 in the interface used to be rejected because T3 +! was imported under the original name T1. + + MODULE MOD + TYPE T1 + SEQUENCE + integer :: j + END TYPE t1 + END + PROGRAM MAIN + USE MOD, T3 => T1 + INTERFACE SUBR + SUBROUTINE SUBR1(X,y) + IMPORT :: T3 + type t1 +! sequence +! integer :: i + end type t1 + TYPE(T3) X +! TYPE(T1) X + END SUBROUTINE + END INTERFACE SUBR + END PROGRAM MAIN + + diff --git a/gcc/testsuite/gfortran.dg/import2.f90 b/gcc/testsuite/gfortran.dg/import2.f90 index d9e65e3..9db2197 100644 --- a/gcc/testsuite/gfortran.dg/import2.f90 +++ b/gcc/testsuite/gfortran.dg/import2.f90 @@ -37,7 +37,7 @@ module testmod interface subroutine other(x,y) import ! { dg-error "Fortran 2003: IMPORT statement" } - type(modType) :: y ! { dg-error "not been declared within the interface" } + type(modType) :: y ! { dg-error "is being used before it is defined" } real(kind) :: x ! { dg-error "has not been declared" } end subroutine end interface @@ -56,13 +56,13 @@ program foo interface subroutine bar(x,y) import ! { dg-error "Fortran 2003: IMPORT statement" } - type(myType) :: x ! { dg-error "not been declared within the interface" } + type(myType) :: x ! { dg-error "is being used before it is defined" } integer(dp) :: y ! { dg-error "has not been declared" } end subroutine bar subroutine test(x) import :: myType3 ! { dg-error "Fortran 2003: IMPORT statement" } import myType3 ! { dg-error "Fortran 2003: IMPORT statement" } - type(myType3) :: x ! { dg-error "not been declared within the interface" } + type(myType3) :: x ! { dg-error "is being used before it is defined" } end subroutine test end interface diff --git a/gcc/testsuite/gfortran.dg/import8.f90 b/gcc/testsuite/gfortran.dg/import8.f90 index 0d88e62..543b0a1 100644 --- a/gcc/testsuite/gfortran.dg/import8.f90 +++ b/gcc/testsuite/gfortran.dg/import8.f90 @@ -12,7 +12,7 @@ end type Connection abstract interface subroutine generic_desc(self) ! <<< missing IMPORT - class(Connection) :: self ! { dg-error "has not been declared within the interface" } + class(Connection) :: self ! { dg-error "is being used before it is defined" } end subroutine generic_desc end interface end diff --git a/gcc/testsuite/gfortran.dg/interface_derived_type_1.f90 b/gcc/testsuite/gfortran.dg/interface_derived_type_1.f90 index 7c165b3..efd81fd 100644 --- a/gcc/testsuite/gfortran.dg/interface_derived_type_1.f90 +++ b/gcc/testsuite/gfortran.dg/interface_derived_type_1.f90 @@ -13,7 +13,7 @@ contains subroutine sim_1(func1,params) interface function func1(fparams) - type(fcnparms) :: fparams ! { dg-error "not been declared within the interface" } + type(fcnparms) :: fparams ! { dg-error "is being used before it is defined" } real :: func1 end function func1 end interface |