diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2008-09-18 20:21:03 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2008-09-18 20:21:03 +0000 |
commit | 334e912a93187986aa51b980b30b50b42fa109c5 (patch) | |
tree | 2632203ed364ae97ee9b947de350525a0cbd781e /gcc/testsuite | |
parent | 47993132a0d2efb2135b952c0012642eef3a4974 (diff) | |
download | gcc-334e912a93187986aa51b980b30b50b42fa109c5.zip gcc-334e912a93187986aa51b980b30b50b42fa109c5.tar.gz gcc-334e912a93187986aa51b980b30b50b42fa109c5.tar.bz2 |
re PR fortran/35945 (Complex module-based overloading fails)
2008-09-18 Paul Thomas <pault@gcc.gnu.org>
PR fortran/35945
* resolve.c (resolve_fl_variable_derived): Remove derived type
comparison for use associated derived types. Host association
of a derived type will not arise if there is a local derived type
whose use name is the same.
PR fortran/36700
* match.c (gfc_match_call): Use the existing symbol even if
it is a function.
2008-09-18 Paul Thomas <pault@gcc.gnu.org>
PR fortran/35945
* gfortran.dg/host_assoc_types_2.f90: New test.
PR fortran/36700
* gfortran.dg/host_assoc_call_2.f90: New test.
From-SVN: r140474
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/host_assoc_call_2.f90 | 18 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/host_assoc_types_2.f90 | 69 |
3 files changed, 95 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f4e5696..ea13346 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2008-09-18 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/35945 + * gfortran.dg/host_assoc_types_2.f90: New test. + + PR fortran/36700 + * gfortran.dg/host_assoc_call_2.f90: New test. + 2008-09-18 DJ Delorie <dj@redhat.com> * gcc.c-torture/execute/20060420-1.c: Fix alignment logic. diff --git a/gcc/testsuite/gfortran.dg/host_assoc_call_2.f90 b/gcc/testsuite/gfortran.dg/host_assoc_call_2.f90 new file mode 100644 index 0000000..a74f373 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/host_assoc_call_2.f90 @@ -0,0 +1,18 @@ +! { dg-do compile } +! Tests the fix for PR36700, in which the call to the function would +! cause an ICE. +! +! Contributed by <terry@chem.gu.se> +! +module Diatoms + implicit none +contains + function InitialDiatomicX () result(v4) ! { dg-error "has a type" } + real(kind = 8), dimension(4) :: v4 + v4 = 1 + end function InitialDiatomicX + subroutine FindDiatomicPeriod + call InitialDiatomicX () ! { dg-error "which is not consistent with the CALL" } + end subroutine FindDiatomicPeriod +end module Diatoms +! { dg-final { cleanup-modules "Diatoms" } } diff --git a/gcc/testsuite/gfortran.dg/host_assoc_types_2.f90 b/gcc/testsuite/gfortran.dg/host_assoc_types_2.f90 new file mode 100644 index 0000000..824a495 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/host_assoc_types_2.f90 @@ -0,0 +1,69 @@ +! { dg-do compile } +! Tests the fix for PR33945, the host association of overloaded_type_s +! would be incorrectly blocked by the use associated overloaded_type. +! +! Contributed by Jonathan Hogg <J.Hogg@rl.ac.uk> +! +module dtype
+ implicit none
+
+ type overloaded_type
+ double precision :: part
+ end type
+
+ interface overloaded_sub
+ module procedure overloaded_sub_d
+ end interface
+
+contains
+ subroutine overloaded_sub_d(otype)
+ type(overloaded_type), intent(in) :: otype
+
+ print *, "d type = ", otype%part
+ end subroutine
+end module
+
+module stype
+ implicit none
+
+ type overloaded_type
+ real :: part
+ end type
+
+ interface overloaded_sub
+ module procedure overloaded_sub_s
+ end interface
+
+contains
+ subroutine overloaded_sub_s(otype)
+ type(overloaded_type), intent(in) :: otype
+
+ print *, "s type = ", otype%part
+ end subroutine
+end module
+
+program test
+ use stype, overloaded_type_s => overloaded_type
+ use dtype, overloaded_type_d => overloaded_type
+ implicit none
+
+ type(overloaded_type_s) :: sval
+ type(overloaded_type_d) :: dval
+
+ sval%part = 1
+ dval%part = 2
+
+ call fred(sval, dval)
+
+contains
+ subroutine fred(sval, dval)
+ use stype
+
+ type(overloaded_type_s), intent(in) :: sval ! This caused an error
+ type(overloaded_type_d), intent(in) :: dval
+
+ call overloaded_sub(sval)
+ call overloaded_sub(dval)
+ end subroutine
+end program
+! { dg-final { cleanup-modules "stype dtype" } }
|