diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2006-09-05 04:26:10 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2006-09-05 04:26:10 +0000 |
commit | 6b887797b23016b8d9d19a8474623958720bf914 (patch) | |
tree | 34273f5fee1aa7762e65f398f90e61ede32f6ffc /gcc/testsuite | |
parent | c9159c40f8660478b5ddee43fd5d7d35680eec42 (diff) | |
download | gcc-6b887797b23016b8d9d19a8474623958720bf914.tar.gz |
re PR fortran/28908 (fold_convert fails for Fortran operator)
2006-09-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/28908
REGRESSION FIX
* gfortran.h : Restore the gfc_dt_list structure and reference
to it in gfc_namespace.
* resolve.c (resolve_fl_derived): Restore the building of the
list of derived types for the current namespace. Modify the
restored code so that a check is made to see if the symbol is
already in the list.
(resolve_fntype): Make sure that the specification block
version of the derived type is used for a module function that
returns that type.
* symbol.c (gfc_free_dt_list): Restore.
(gfc_free_namespace): Restore call to previous.
* trans-types.c (copy_dt_decls_ifequal): Restore.
(gfc_get_derived_type): Restore all the paraphenalia for
association of derived types, including calls to previous.
Modify the restored code such that all derived types are built
if their symbols are found in the parent namespace; not just
non-module types. Add backend_decls to like derived types in
sibling namespaces, as well as that of the derived type.
2006-09-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/28908
* gfortran.dg/used_types_7.f90: New test.
* gfortran.dg/used_types_8.f90: New test.
* gfortran.dg/used_types_9.f90: New test.
From-SVN: r116690
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/used_types_7.f90 | 39 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/used_types_8.f90 | 46 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/used_types_9.f90 | 36 |
4 files changed, 128 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index df6d0f9b6ac..0355796a543 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2006-09-05 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/28908 + * gfortran.dg/used_types_7.f90: New test. + * gfortran.dg/used_types_8.f90: New test. + * gfortran.dg/used_types_9.f90: New test. + 2006-09-04 Eric Botcazou <ebotcazou@libertysurf.fr> * gcc.c-torture/compile/20060904-1.c: New test. diff --git a/gcc/testsuite/gfortran.dg/used_types_7.f90 b/gcc/testsuite/gfortran.dg/used_types_7.f90 new file mode 100644 index 00000000000..91354005d21 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/used_types_7.f90 @@ -0,0 +1,39 @@ +! { dg-do compile } +! Tests the fix for a further regression caused by the +! fix for PR28788 and posted as PR28908. The problem was +! caused by the patch preventing interface derived types +! from associating with identical derived types in the +! containing namespaces. +! +! Contributed by HJ Lu <hjl@lucon.org> +! +module bar + implicit none + public + type ESMF_Time + integer :: DD + end type +end module bar + +module foo + use bar + implicit none + private + type ESMF_Clock + type(ESMF_Time) :: CurrTime + end type + interface operator (+) + function add (x, y) + use bar + type(ESMF_Time) :: add + type(ESMF_Time), intent(in) :: x + type(ESMF_Time), intent(in) :: y + end function add + end interface +contains + subroutine ESMF_ClockAdvance(clock) + type(ESMF_Clock), intent(inout) :: clock + clock%CurrTime = clock%CurrTime + clock%CurrTime + end subroutine ESMF_ClockAdvance +end module foo +! { dg-final { cleanup-modules "foo bar" } } diff --git a/gcc/testsuite/gfortran.dg/used_types_8.f90 b/gcc/testsuite/gfortran.dg/used_types_8.f90 new file mode 100644 index 00000000000..58d2084f362 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/used_types_8.f90 @@ -0,0 +1,46 @@ +! { dg-do compile } +! Tests the fix for a further regression caused by the +! fix for PR28788 and posted as PR28908. The problem was +! caused by the patch preventing interface derived types +! from associating with identical derived types in the +! containing namespaces. +! +! Contributed by HJ Lu <hjl@lucon.org> +! +module bar + implicit none + public + type ESMF_Time + sequence + integer :: MM + end type + public operator (+) + private add + interface operator (+) + module procedure add + end interface +contains + function add (x, y) + type(ESMF_Time) :: add + type(ESMF_Time), intent(in) :: x + type(ESMF_Time), intent(in) :: y + add = x + end function add +end module bar + +module foo + use bar + implicit none + private + type ESMF_Clock + sequence + type(ESMF_Time) :: CurrTime + end type +contains + subroutine ESMF_ClockAdvance(clock) + use bar + type(ESMF_Clock), intent(inout) :: clock + clock%CurrTime = clock%CurrTime + clock%CurrTime + end subroutine ESMF_ClockAdvance +end module foo +! { dg-final { cleanup-modules "foo bar" } } diff --git a/gcc/testsuite/gfortran.dg/used_types_9.f90 b/gcc/testsuite/gfortran.dg/used_types_9.f90 new file mode 100644 index 00000000000..fc09d155c0f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/used_types_9.f90 @@ -0,0 +1,36 @@ +! { dg-do compile }
+! Tests the fix for a further regression caused by the
+! fix for PR28788 and posted as PR28908. The problem was
+! caused by the patch preventing interface derived types
+! from associating with identical derived types in the
+! containing namespaces.
+!
+! Contributed by HJ Lu <hjl@lucon.org>
+!
+module bar
+ implicit none
+ public
+ type domain_ptr
+ type(domain), POINTER :: ptr
+ end type domain_ptr
+ type domain
+ TYPE(domain_ptr) , DIMENSION( : ) , POINTER :: parents
+ TYPE(domain_ptr) , DIMENSION( : ) , POINTER :: nests
+ end type domain
+end module bar
+
+module foo
+contains
+ recursive subroutine integrate (grid)
+ use bar
+ implicit none
+ type(domain), POINTER :: grid
+ interface
+ subroutine solve_interface (grid)
+ use bar
+ TYPE (domain) grid
+ end subroutine solve_interface
+ end interface
+ end subroutine integrate
+end module foo
+! { dg-final { cleanup-modules "foo bar" } }
|