From 82c027e160f351c62ef09a5167a3ad6b680e8017 Mon Sep 17 00:00:00 2001 From: Dominique d'Humieres Date: Sun, 4 Jun 2017 20:44:45 +0200 Subject: [PATCH] fortran-modules.exp (igrep): New procedure, case insensitive vesrion of the dejagnu grep. 2017-06-04 Dominique d'Humieres * lib/fortran-modules.exp (igrep): New procedure, case insensitive vesrion of the dejagnu grep. (list-module-names): Use it and adjust the regular expressions for modules and submodules. * gfortran.dg/prof/prof.exp: Cleanup modules. * gfortran.dg/allocate_class_4.f90: Remove cleanup-(sub)?modules directives. * gfortran.dg/altreturn_8.f90: Likewise. * gfortran.dg/associate_12.f90: Likewise. * gfortran.dg/c_f_pointer_shape_test.f90: Likewise. * gfortran.dg/charlen_15.f90: Likewise. * gfortran.dg/class_4a.f03: Likewise. * gfortran.dg/class_54.f90: Likewise. * gfortran.dg/class_dummy_4.f03: Likewise. * gfortran.dg/class_dummy_5.f90: Likewise. * gfortran.dg/constructor_9.f90: Likewise. * gfortran.dg/dec_structure_15.f90: Likewise. * gfortran.dg/do_check_8.f90: Likewise. * gfortran.dg/dtio_26.f03: Likewise. * gfortran.dg/dynamic_dispatch_12.f90: Likewise. * gfortran.dg/equiv_9.f90: Likewise. * gfortran.dg/extends_15.f90: Likewise. * gfortran.dg/finalize_22.f90: Likewise. * gfortran.dg/finalize_23.f90: Likewise. * gfortran.dg/generic_26.f90: Likewise. * gfortran.dg/generic_27.f90: Likewise. * gfortran.dg/namelist_76.f90: Likewise. * gfortran.dg/pointer_init_8.f90: Likewise. * gfortran.dg/pr61318.f90: Likewise. * gfortran.dg/pr77260_1.f90: Likewise. * gfortran.dg/pr77260_2.f90: Likewise. * gfortran.dg/pr77420_3.f90: Likewise. * gfortran.dg/proc_ptr_39.f90: Likewise. * gfortran.dg/proc_ptr_41.f90: Likewise. * gfortran.dg/proc_ptr_42.f90: Likewise. * gfortran.dg/proc_ptr_comp_43.f90: Likewise. * gfortran.dg/submodule_1.f08: Likewise. * gfortran.dg/submodule_10.f08: Likewise. * gfortran.dg/submodule_14.f08: Likewise. * gfortran.dg/submodule_15.f08: Likewise. * gfortran.dg/submodule_2.f08: Likewise. * gfortran.dg/submodule_5.f08: Likewise. * gfortran.dg/submodule_6.f08: Likewise. * gfortran.dg/submodule_7.f08: Likewise. * gfortran.dg/submodule_8.f08: Likewise. * gfortran.dg/submodule_9.f08: Likewise. * gfortran.dg/transfer_class_2.f90: Likewise. * gfortran.dg/typebound_assignment_7.f90: Likewise. * gfortran.dg/typebound_call_24.f03: Likewise. * gfortran.dg/typebound_call_25.f90: Likewise. * gfortran.dg/typebound_deferred_1.f90: Likewise. * gfortran.dg/typebound_generic_12.f03: Likewise. * gfortran.dg/typebound_generic_13.f03: Likewise. * gfortran.dg/typebound_generic_14.f03: Likewise. * gfortran.dg/typebound_generic_15.f90: Likewise. * gfortran.dg/typebound_operator_16.f03: Likewise. * gfortran.dg/typebound_operator_18.f90: Likewise. * gfortran.dg/typebound_operator_20.f90: Likewise. * gfortran.dg/typebound_override_3.f90: Likewise. * gfortran.dg/typebound_override_4.f90: Likewise. * gfortran.dg/typebound_override_5.f90: Likewise. * gfortran.dg/typebound_override_6.f90: Likewise. * gfortran.dg/typebound_override_7.f90: Likewise. * gfortran.dg/typebound_proc_28.f03: Likewise. * gfortran.dg/typebound_proc_29.f90: Likewise. * gfortran.dg/typebound_proc_30.f90: Likewise. * gfortran.dg/typebound_proc_31.f90: Likewise. * gfortran.dg/typebound_proc_32.f90: Likewise. * gfortran.dg/typebound_proc_33.f90: Likewise. * gfortran.dg/unlimited_polymorphic_16.f90: Likewise. * gfortran.dg/unlimited_polymorphic_19.f90: Likewise. * gfortran.dg/unlimited_polymorphic_24.f03: Likewise. * gfortran.dg/use_only_3.f90: Likewise. * gfortran.dg/use_without_only_1.f90: Likewise. * gfortran.dg/warn_unused_function.f90: Likewise. * gfortran.dg/warn_unused_function_2.f90: Likewise. * gfortran.dg/ieee/ieee_8.f90: Likewise. From-SVN: r248861 --- gcc/testsuite/ChangeLog | 79 +++++++++++++++++++ .../gfortran.dg/allocate_class_4.f90 | 3 - gcc/testsuite/gfortran.dg/altreturn_8.f90 | 44 +++++------ gcc/testsuite/gfortran.dg/associate_12.f90 | 2 - .../gfortran.dg/c_f_pointer_shape_test.f90 | 2 - gcc/testsuite/gfortran.dg/charlen_15.f90 | 2 - gcc/testsuite/gfortran.dg/class_4a.f03 | 1 - gcc/testsuite/gfortran.dg/class_54.f90 | 2 - gcc/testsuite/gfortran.dg/class_dummy_4.f03 | 2 - gcc/testsuite/gfortran.dg/class_dummy_5.f90 | 2 - gcc/testsuite/gfortran.dg/constructor_9.f90 | 2 - .../gfortran.dg/dec_structure_15.f90 | 1 - gcc/testsuite/gfortran.dg/do_check_8.f90 | 1 - gcc/testsuite/gfortran.dg/dtio_26.f03 | 2 - .../gfortran.dg/dynamic_dispatch_12.f90 | 2 - gcc/testsuite/gfortran.dg/equiv_9.f90 | 1 - gcc/testsuite/gfortran.dg/extends_15.f90 | 2 - gcc/testsuite/gfortran.dg/finalize_22.f90 | 2 - gcc/testsuite/gfortran.dg/finalize_23.f90 | 2 - gcc/testsuite/gfortran.dg/generic_26.f90 | 2 - gcc/testsuite/gfortran.dg/generic_27.f90 | 2 - gcc/testsuite/gfortran.dg/ieee/ieee_8.f90 | 2 - gcc/testsuite/gfortran.dg/namelist_76.f90 | 2 - gcc/testsuite/gfortran.dg/pointer_init_8.f90 | 2 - gcc/testsuite/gfortran.dg/pr61318.f90 | 1 - gcc/testsuite/gfortran.dg/pr77260_1.f90 | 1 - gcc/testsuite/gfortran.dg/pr77260_2.f90 | 1 - gcc/testsuite/gfortran.dg/pr77420_3.f90 | 1 - gcc/testsuite/gfortran.dg/proc_ptr_39.f90 | 2 - gcc/testsuite/gfortran.dg/proc_ptr_41.f90 | 2 - gcc/testsuite/gfortran.dg/proc_ptr_42.f90 | 2 - gcc/testsuite/gfortran.dg/prof/prof.exp | 3 + gcc/testsuite/gfortran.dg/submodule_1.f08 | 3 - gcc/testsuite/gfortran.dg/submodule_10.f08 | 2 - gcc/testsuite/gfortran.dg/submodule_14.f08 | 1 - gcc/testsuite/gfortran.dg/submodule_15.f08 | 1 - gcc/testsuite/gfortran.dg/submodule_2.f08 | 2 - gcc/testsuite/gfortran.dg/submodule_5.f08 | 1 - gcc/testsuite/gfortran.dg/submodule_6.f08 | 3 - gcc/testsuite/gfortran.dg/submodule_7.f08 | 2 - gcc/testsuite/gfortran.dg/submodule_8.f08 | 1 - gcc/testsuite/gfortran.dg/submodule_9.f08 | 1 - .../gfortran.dg/transfer_class_2.f90 | 2 - .../gfortran.dg/typebound_assignment_7.f90 | 2 - .../gfortran.dg/typebound_call_24.f03 | 2 - .../gfortran.dg/typebound_call_25.f90 | 2 - .../gfortran.dg/typebound_deferred_1.f90 | 2 - .../gfortran.dg/typebound_generic_12.f03 | 2 - .../gfortran.dg/typebound_generic_13.f03 | 2 - .../gfortran.dg/typebound_generic_14.f03 | 2 - .../gfortran.dg/typebound_generic_15.f90 | 2 - .../gfortran.dg/typebound_operator_16.f03 | 2 - .../gfortran.dg/typebound_operator_18.f90 | 2 - .../gfortran.dg/typebound_operator_20.f90 | 2 - .../gfortran.dg/typebound_override_3.f90 | 2 - .../gfortran.dg/typebound_override_4.f90 | 2 - .../gfortran.dg/typebound_override_5.f90 | 78 +++++++++--------- .../gfortran.dg/typebound_override_6.f90 | 76 +++++++++--------- .../gfortran.dg/typebound_override_7.f90 | 76 +++++++++--------- .../gfortran.dg/typebound_proc_28.f03 | 2 - .../gfortran.dg/typebound_proc_29.f90 | 2 - .../gfortran.dg/typebound_proc_30.f90 | 2 - .../gfortran.dg/typebound_proc_31.f90 | 2 - .../gfortran.dg/typebound_proc_32.f90 | 2 - .../gfortran.dg/typebound_proc_33.f90 | 2 - .../gfortran.dg/unlimited_polymorphic_16.f90 | 2 - .../gfortran.dg/unlimited_polymorphic_19.f90 | 2 - .../gfortran.dg/unlimited_polymorphic_24.f03 | 2 - gcc/testsuite/gfortran.dg/use_only_3.f90 | 1 - .../gfortran.dg/use_without_only_1.f90 | 1 - .../gfortran.dg/warn_unused_function.f90 | 2 - .../gfortran.dg/warn_unused_function_2.f90 | 2 - gcc/testsuite/lib/fortran-modules.exp | 69 +++++++++++++++- 73 files changed, 280 insertions(+), 265 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bfadad53601..3c6a47e824e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,82 @@ +2017-06-04 Dominique d'Humieres + + * lib/fortran-modules.exp (igrep): New procedure, case insensitive + vesrion of the dejagnu grep. + (list-module-names): Use it and adjust the regular expressions for + modules and submodules. + * gfortran.dg/prof/prof.exp: Cleanup modules. + * gfortran.dg/allocate_class_4.f90: Remove cleanup-(sub)?modules + directives. + * gfortran.dg/altreturn_8.f90: Likewise. + * gfortran.dg/associate_12.f90: Likewise. + * gfortran.dg/c_f_pointer_shape_test.f90: Likewise. + * gfortran.dg/charlen_15.f90: Likewise. + * gfortran.dg/class_4a.f03: Likewise. + * gfortran.dg/class_54.f90: Likewise. + * gfortran.dg/class_dummy_4.f03: Likewise. + * gfortran.dg/class_dummy_5.f90: Likewise. + * gfortran.dg/constructor_9.f90: Likewise. + * gfortran.dg/dec_structure_15.f90: Likewise. + * gfortran.dg/do_check_8.f90: Likewise. + * gfortran.dg/dtio_26.f03: Likewise. + * gfortran.dg/dynamic_dispatch_12.f90: Likewise. + * gfortran.dg/equiv_9.f90: Likewise. + * gfortran.dg/extends_15.f90: Likewise. + * gfortran.dg/finalize_22.f90: Likewise. + * gfortran.dg/finalize_23.f90: Likewise. + * gfortran.dg/generic_26.f90: Likewise. + * gfortran.dg/generic_27.f90: Likewise. + * gfortran.dg/namelist_76.f90: Likewise. + * gfortran.dg/pointer_init_8.f90: Likewise. + * gfortran.dg/pr61318.f90: Likewise. + * gfortran.dg/pr77260_1.f90: Likewise. + * gfortran.dg/pr77260_2.f90: Likewise. + * gfortran.dg/pr77420_3.f90: Likewise. + * gfortran.dg/proc_ptr_39.f90: Likewise. + * gfortran.dg/proc_ptr_41.f90: Likewise. + * gfortran.dg/proc_ptr_42.f90: Likewise. + * gfortran.dg/proc_ptr_comp_43.f90: Likewise. + * gfortran.dg/submodule_1.f08: Likewise. + * gfortran.dg/submodule_10.f08: Likewise. + * gfortran.dg/submodule_14.f08: Likewise. + * gfortran.dg/submodule_15.f08: Likewise. + * gfortran.dg/submodule_2.f08: Likewise. + * gfortran.dg/submodule_5.f08: Likewise. + * gfortran.dg/submodule_6.f08: Likewise. + * gfortran.dg/submodule_7.f08: Likewise. + * gfortran.dg/submodule_8.f08: Likewise. + * gfortran.dg/submodule_9.f08: Likewise. + * gfortran.dg/transfer_class_2.f90: Likewise. + * gfortran.dg/typebound_assignment_7.f90: Likewise. + * gfortran.dg/typebound_call_24.f03: Likewise. + * gfortran.dg/typebound_call_25.f90: Likewise. + * gfortran.dg/typebound_deferred_1.f90: Likewise. + * gfortran.dg/typebound_generic_12.f03: Likewise. + * gfortran.dg/typebound_generic_13.f03: Likewise. + * gfortran.dg/typebound_generic_14.f03: Likewise. + * gfortran.dg/typebound_generic_15.f90: Likewise. + * gfortran.dg/typebound_operator_16.f03: Likewise. + * gfortran.dg/typebound_operator_18.f90: Likewise. + * gfortran.dg/typebound_operator_20.f90: Likewise. + * gfortran.dg/typebound_override_3.f90: Likewise. + * gfortran.dg/typebound_override_4.f90: Likewise. + * gfortran.dg/typebound_override_5.f90: Likewise. + * gfortran.dg/typebound_override_6.f90: Likewise. + * gfortran.dg/typebound_override_7.f90: Likewise. + * gfortran.dg/typebound_proc_28.f03: Likewise. + * gfortran.dg/typebound_proc_29.f90: Likewise. + * gfortran.dg/typebound_proc_30.f90: Likewise. + * gfortran.dg/typebound_proc_31.f90: Likewise. + * gfortran.dg/typebound_proc_32.f90: Likewise. + * gfortran.dg/typebound_proc_33.f90: Likewise. + * gfortran.dg/unlimited_polymorphic_16.f90: Likewise. + * gfortran.dg/unlimited_polymorphic_19.f90: Likewise. + * gfortran.dg/unlimited_polymorphic_24.f03: Likewise. + * gfortran.dg/use_only_3.f90: Likewise. + * gfortran.dg/use_without_only_1.f90: Likewise. + * gfortran.dg/warn_unused_function.f90: Likewise. + * gfortran.dg/warn_unused_function_2.f90: Likewise. + * gfortran.dg/ieee/ieee_8.f90: Likewise. 2017-06-04 Marek Polacek PR c/80919 diff --git a/gcc/testsuite/gfortran.dg/allocate_class_4.f90 b/gcc/testsuite/gfortran.dg/allocate_class_4.f90 index 23c9d53d171..125d99f4d86 100644 --- a/gcc/testsuite/gfortran.dg/allocate_class_4.f90 +++ b/gcc/testsuite/gfortran.dg/allocate_class_4.f90 @@ -31,6 +31,3 @@ module integrable_model_module end subroutine end module integrable_model_module - -! { dg-final { cleanup-modules "integrable_model_module" } } - diff --git a/gcc/testsuite/gfortran.dg/altreturn_8.f90 b/gcc/testsuite/gfortran.dg/altreturn_8.f90 index ccd58a2b083..63a6ef72420 100644 --- a/gcc/testsuite/gfortran.dg/altreturn_8.f90 +++ b/gcc/testsuite/gfortran.dg/altreturn_8.f90 @@ -1,23 +1,21 @@ -! { dg-do compile } -! { dg-options "-std=gnu" } -! -! PR 56284: [OOP] ICE with alternate return in type-bound procedure -! -! Contributed by Arjen Markus - -module try_this - implicit none - - type :: table_t - contains - procedure, nopass :: getRecord - end type - -contains - - subroutine getRecord ( * ) - end subroutine - -end module - -! { dg-final { cleanup-modules "try_this" } } +! { dg-do compile } +! { dg-options "-std=gnu" } +! +! PR 56284: [OOP] ICE with alternate return in type-bound procedure +! +! Contributed by Arjen Markus + +module try_this + implicit none + + type :: table_t + contains + procedure, nopass :: getRecord + end type + +contains + + subroutine getRecord ( * ) + end subroutine + +end module diff --git a/gcc/testsuite/gfortran.dg/associate_12.f90 b/gcc/testsuite/gfortran.dg/associate_12.f90 index 1ead1e7112e..8d2abb8adb1 100644 --- a/gcc/testsuite/gfortran.dg/associate_12.f90 +++ b/gcc/testsuite/gfortran.dg/associate_12.f90 @@ -25,5 +25,3 @@ program assoc_err print *, 1. + b end associate end program - -! { dg-final { cleanup-modules "assoc_err_m" } } diff --git a/gcc/testsuite/gfortran.dg/c_f_pointer_shape_test.f90 b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_test.f90 index 9b130ad6e59..86377123af6 100644 --- a/gcc/testsuite/gfortran.dg/c_f_pointer_shape_test.f90 +++ b/gcc/testsuite/gfortran.dg/c_f_pointer_shape_test.f90 @@ -16,5 +16,3 @@ contains call c_f_pointer(cPtr, myArrayPtr) ! { dg-error "Expected SHAPE argument to C_F_POINTER with array FPTR" } end subroutine test_0 end module c_f_pointer_shape_test - -! { dg-final { cleanup-modules "c_f_pointer_shape_test" } } diff --git a/gcc/testsuite/gfortran.dg/charlen_15.f90 b/gcc/testsuite/gfortran.dg/charlen_15.f90 index e141f1eb3ac..ed8ff00bec1 100644 --- a/gcc/testsuite/gfortran.dg/charlen_15.f90 +++ b/gcc/testsuite/gfortran.dg/charlen_15.f90 @@ -10,5 +10,3 @@ program foo use m if (trim(x%c(1)) /= 'ab') call abort end program foo -! { dg-final { cleanup-modules "m" } } - diff --git a/gcc/testsuite/gfortran.dg/class_4a.f03 b/gcc/testsuite/gfortran.dg/class_4a.f03 index 015e53cbb1b..a6406a898a8 100644 --- a/gcc/testsuite/gfortran.dg/class_4a.f03 +++ b/gcc/testsuite/gfortran.dg/class_4a.f03 @@ -13,4 +13,3 @@ module m type t end type t end module m -! { dg-final { cleanup-modules "m m2" } } diff --git a/gcc/testsuite/gfortran.dg/class_54.f90 b/gcc/testsuite/gfortran.dg/class_54.f90 index 39c306c83d0..fdcdebc54c4 100644 --- a/gcc/testsuite/gfortran.dg/class_54.f90 +++ b/gcc/testsuite/gfortran.dg/class_54.f90 @@ -18,5 +18,3 @@ subroutine sub2 use m class(t), pointer :: a2 end subroutine - -! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/class_dummy_4.f03 b/gcc/testsuite/gfortran.dg/class_dummy_4.f03 index 24841305bf5..6c2abad546a 100644 --- a/gcc/testsuite/gfortran.dg/class_dummy_4.f03 +++ b/gcc/testsuite/gfortran.dg/class_dummy_4.f03 @@ -40,5 +40,3 @@ contains type(c_stv), allocatable, intent(out) :: y end subroutine end - -! { dg-final { cleanup-modules "m1 m2" } } diff --git a/gcc/testsuite/gfortran.dg/class_dummy_5.f90 b/gcc/testsuite/gfortran.dg/class_dummy_5.f90 index 8da19af1ee6..78fc4f8c622 100644 --- a/gcc/testsuite/gfortran.dg/class_dummy_5.f90 +++ b/gcc/testsuite/gfortran.dg/class_dummy_5.f90 @@ -26,5 +26,3 @@ contains class(t), intent(out) :: x end subroutine end - -! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/constructor_9.f90 b/gcc/testsuite/gfortran.dg/constructor_9.f90 index 5196703031a..a8e882138fd 100644 --- a/gcc/testsuite/gfortran.dg/constructor_9.f90 +++ b/gcc/testsuite/gfortran.dg/constructor_9.f90 @@ -18,5 +18,3 @@ contains cfd=cfmde() ! { dg-error "Can't convert" } end subroutine end module - -! { dg-final { cleanup-modules "cf" } } diff --git a/gcc/testsuite/gfortran.dg/dec_structure_15.f90 b/gcc/testsuite/gfortran.dg/dec_structure_15.f90 index fd06ff9f10d..33f51266c0f 100644 --- a/gcc/testsuite/gfortran.dg/dec_structure_15.f90 +++ b/gcc/testsuite/gfortran.dg/dec_structure_15.f90 @@ -24,4 +24,3 @@ contains a2 = 0.0 end function end module -! { dg-final { cleanup-modules "dec_structure_15" } } diff --git a/gcc/testsuite/gfortran.dg/do_check_8.f90 b/gcc/testsuite/gfortran.dg/do_check_8.f90 index 458ae40b604..5b9acc3d68f 100644 --- a/gcc/testsuite/gfortran.dg/do_check_8.f90 +++ b/gcc/testsuite/gfortran.dg/do_check_8.f90 @@ -56,4 +56,3 @@ program main call sub(undeclared) end do end program main -! { dg-final { cleanup-modules "foo" } } diff --git a/gcc/testsuite/gfortran.dg/dtio_26.f03 b/gcc/testsuite/gfortran.dg/dtio_26.f03 index e947545fb49..ad05da0523e 100644 --- a/gcc/testsuite/gfortran.dg/dtio_26.f03 +++ b/gcc/testsuite/gfortran.dg/dtio_26.f03 @@ -65,5 +65,3 @@ program p read( unit=s, fmt=*, iostat=istat, iomsg=imsg) foo if (imsg.ne."End of record") call abort end program p - -! { dg-final { cleanup-modules "t_m" } } diff --git a/gcc/testsuite/gfortran.dg/dynamic_dispatch_12.f90 b/gcc/testsuite/gfortran.dg/dynamic_dispatch_12.f90 index d37e1f6a9b5..53cc957c4d2 100644 --- a/gcc/testsuite/gfortran.dg/dynamic_dispatch_12.f90 +++ b/gcc/testsuite/gfortran.dg/dynamic_dispatch_12.f90 @@ -70,5 +70,3 @@ contains end subroutine end - -! { dg-final { cleanup-modules "TestResult_mod BaseTestRunner_mod TestRunner_mod" } } diff --git a/gcc/testsuite/gfortran.dg/equiv_9.f90 b/gcc/testsuite/gfortran.dg/equiv_9.f90 index 28f0bb8bbf1..5a226282161 100644 --- a/gcc/testsuite/gfortran.dg/equiv_9.f90 +++ b/gcc/testsuite/gfortran.dg/equiv_9.f90 @@ -19,4 +19,3 @@ subroutine another() implicit none if (x2 /= 2) call abort end subroutine -! { dg-final { cleanup-modules "constant" } } diff --git a/gcc/testsuite/gfortran.dg/extends_15.f90 b/gcc/testsuite/gfortran.dg/extends_15.f90 index 06c31799a00..03f1ff15a18 100644 --- a/gcc/testsuite/gfortran.dg/extends_15.f90 +++ b/gcc/testsuite/gfortran.dg/extends_15.f90 @@ -12,5 +12,3 @@ module ct type :: t1 end type end - -! { dg-final { cleanup-modules "ct" } } diff --git a/gcc/testsuite/gfortran.dg/finalize_22.f90 b/gcc/testsuite/gfortran.dg/finalize_22.f90 index 57fa6e78de3..cad44815796 100644 --- a/gcc/testsuite/gfortran.dg/finalize_22.f90 +++ b/gcc/testsuite/gfortran.dg/finalize_22.f90 @@ -16,5 +16,3 @@ contains class(cfml), intent(inout) :: s end subroutine mld end module cf - -! { dg-final { cleanup-modules "cf" } } diff --git a/gcc/testsuite/gfortran.dg/finalize_23.f90 b/gcc/testsuite/gfortran.dg/finalize_23.f90 index ea3972981da..9dab53e1f13 100644 --- a/gcc/testsuite/gfortran.dg/finalize_23.f90 +++ b/gcc/testsuite/gfortran.dg/finalize_23.f90 @@ -27,5 +27,3 @@ contains end function end module - -! { dg-final { cleanup-modules "ObjectLists" } } diff --git a/gcc/testsuite/gfortran.dg/generic_26.f90 b/gcc/testsuite/gfortran.dg/generic_26.f90 index 22a593b4227..81a0604fbcc 100644 --- a/gcc/testsuite/gfortran.dg/generic_26.f90 +++ b/gcc/testsuite/gfortran.dg/generic_26.f90 @@ -25,5 +25,3 @@ contains end function end - -! { dg-final { cleanup-modules "a" } } diff --git a/gcc/testsuite/gfortran.dg/generic_27.f90 b/gcc/testsuite/gfortran.dg/generic_27.f90 index f4f4f5ab9c3..6f603ae4c91 100644 --- a/gcc/testsuite/gfortran.dg/generic_27.f90 +++ b/gcc/testsuite/gfortran.dg/generic_27.f90 @@ -30,5 +30,3 @@ program test if (testIF(cos)/=1.0) call abort() end program - -! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/ieee/ieee_8.f90 b/gcc/testsuite/gfortran.dg/ieee/ieee_8.f90 index 7d0cdfd0e03..a47f9c16b91 100644 --- a/gcc/testsuite/gfortran.dg/ieee/ieee_8.f90 +++ b/gcc/testsuite/gfortran.dg/ieee/ieee_8.f90 @@ -111,5 +111,3 @@ subroutine gee(n, rounding, flag) if (len(s8) /= x8) call abort end subroutine - -! { dg-final { cleanup-modules "foo bar" } } diff --git a/gcc/testsuite/gfortran.dg/namelist_76.f90 b/gcc/testsuite/gfortran.dg/namelist_76.f90 index acb3b2f6561..9c233fb5bcb 100644 --- a/gcc/testsuite/gfortran.dg/namelist_76.f90 +++ b/gcc/testsuite/gfortran.dg/namelist_76.f90 @@ -24,5 +24,3 @@ subroutine write_data() write(10, nml=write_data_list) close(10) end subroutine write_data - -! { dg-final { cleanup-modules "data" } } diff --git a/gcc/testsuite/gfortran.dg/pointer_init_8.f90 b/gcc/testsuite/gfortran.dg/pointer_init_8.f90 index aacd9a8e16e..8c6bdb2a6a3 100644 --- a/gcc/testsuite/gfortran.dg/pointer_init_8.f90 +++ b/gcc/testsuite/gfortran.dg/pointer_init_8.f90 @@ -22,5 +22,3 @@ end module m if (.not. associated(py, y)) call abort() if (.not. same_type_as(py, y)) call abort() end - -! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/pr61318.f90 b/gcc/testsuite/gfortran.dg/pr61318.f90 index 4e7e862c443..57da52d5890 100644 --- a/gcc/testsuite/gfortran.dg/pr61318.f90 +++ b/gcc/testsuite/gfortran.dg/pr61318.f90 @@ -20,4 +20,3 @@ program test use gbl_interfaces call gagout(seve%e,'Some string') ! { dg-error "Type mismatch in argument" } end program test -! { dg-final { cleanup-modules "gbl_interfaces gbl_message" } } diff --git a/gcc/testsuite/gfortran.dg/pr77260_1.f90 b/gcc/testsuite/gfortran.dg/pr77260_1.f90 index 0d2ead61ce7..76ef3cffced 100644 --- a/gcc/testsuite/gfortran.dg/pr77260_1.f90 +++ b/gcc/testsuite/gfortran.dg/pr77260_1.f90 @@ -22,4 +22,3 @@ program test implicit none print *,f2() end program -! { dg-final { cleanup-modules "foo" } } diff --git a/gcc/testsuite/gfortran.dg/pr77260_2.f90 b/gcc/testsuite/gfortran.dg/pr77260_2.f90 index ea8da4f271c..0c5ebe3a656 100644 --- a/gcc/testsuite/gfortran.dg/pr77260_2.f90 +++ b/gcc/testsuite/gfortran.dg/pr77260_2.f90 @@ -23,4 +23,3 @@ program test implicit none print *,f2() end program -! { dg-final { cleanup-modules "foo" } } diff --git a/gcc/testsuite/gfortran.dg/pr77420_3.f90 b/gcc/testsuite/gfortran.dg/pr77420_3.f90 index cf95ac05f83..c53fce7b438 100644 --- a/gcc/testsuite/gfortran.dg/pr77420_3.f90 +++ b/gcc/testsuite/gfortran.dg/pr77420_3.f90 @@ -6,4 +6,3 @@ module h5global integer :: h5p_default_f, h5p_flags equivalence(h5p_flags, h5p_default_f) end module h5global -! { dg-final { cleanup-modules "h5global" } } diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_39.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_39.f90 index 2be5d651793..b3e0eb995ba 100644 --- a/gcc/testsuite/gfortran.dg/proc_ptr_39.f90 +++ b/gcc/testsuite/gfortran.dg/proc_ptr_39.f90 @@ -17,5 +17,3 @@ program Test use Module1 use Module2 end program - -! { dg-final { cleanup-modules "Module1 Module2" } } diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_41.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_41.f90 index 7f50abab21a..534ab0fb5a7 100644 --- a/gcc/testsuite/gfortran.dg/proc_ptr_41.f90 +++ b/gcc/testsuite/gfortran.dg/proc_ptr_41.f90 @@ -33,5 +33,3 @@ program crash_test ptr => generic_name_get_proc_ptr() end program - -! { dg-final { cleanup-modules "test" } } diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_42.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_42.f90 index 8556fdf0c21..c92e537acbe 100644 --- a/gcc/testsuite/gfortran.dg/proc_ptr_42.f90 +++ b/gcc/testsuite/gfortran.dg/proc_ptr_42.f90 @@ -32,5 +32,3 @@ program p use m2 call ns_dirdata(f) end - -! { dg-final { cleanup-modules "m1 m2" } } diff --git a/gcc/testsuite/gfortran.dg/prof/prof.exp b/gcc/testsuite/gfortran.dg/prof/prof.exp index 5b0ed55c3c6..dc9a7ba65bf 100644 --- a/gcc/testsuite/gfortran.dg/prof/prof.exp +++ b/gcc/testsuite/gfortran.dg/prof/prof.exp @@ -18,6 +18,7 @@ # ordering using -fprofile-generate followed by -fprofile-use. load_lib target-supports.exp +load_lib fortran-modules.exp # Some targets don't support tree profiling. if { ![check_profiling_available "-fprofile-generate"] } { @@ -50,7 +51,9 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.f*]] { if ![runtest_file_p $runtests $src] then { continue } + list-module-names $src profopt-execute $src + cleanup-modules "" } foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.f*]] { diff --git a/gcc/testsuite/gfortran.dg/submodule_1.f08 b/gcc/testsuite/gfortran.dg/submodule_1.f08 index 578492e54e7..2c5d373206e 100644 --- a/gcc/testsuite/gfortran.dg/submodule_1.f08 +++ b/gcc/testsuite/gfortran.dg/submodule_1.f08 @@ -170,6 +170,3 @@ message2 = "" end subroutine end program -! { dg-final { cleanup-submodules "foo_interface@foo_interface_son" } } -! { dg-final { cleanup-submodules "foo_interface@foo_interface_grandson" } } -! { dg-final { cleanup-submodules "foo_interface@foo_interface_daughter" } } diff --git a/gcc/testsuite/gfortran.dg/submodule_10.f08 b/gcc/testsuite/gfortran.dg/submodule_10.f08 index e956b2905c3..373b11c9f96 100644 --- a/gcc/testsuite/gfortran.dg/submodule_10.f08 +++ b/gcc/testsuite/gfortran.dg/submodule_10.f08 @@ -167,5 +167,3 @@ program testlk stop end program testlk -! { dg-final { cleanup-submodules "error_mod@error_impl_mod" } } - diff --git a/gcc/testsuite/gfortran.dg/submodule_14.f08 b/gcc/testsuite/gfortran.dg/submodule_14.f08 index cbfc3d1d4b1..bc8fd8042a7 100644 --- a/gcc/testsuite/gfortran.dg/submodule_14.f08 +++ b/gcc/testsuite/gfortran.dg/submodule_14.f08 @@ -46,4 +46,3 @@ end submodule testson x = 10 if (fcn1 (x) .ne. 0) call abort end -! { dg-final { cleanup-submodules "test@testson" } } diff --git a/gcc/testsuite/gfortran.dg/submodule_15.f08 b/gcc/testsuite/gfortran.dg/submodule_15.f08 index a09a7e7e403..499bc66d5ac 100644 --- a/gcc/testsuite/gfortran.dg/submodule_15.f08 +++ b/gcc/testsuite/gfortran.dg/submodule_15.f08 @@ -56,4 +56,3 @@ end submodule incr = 1 if (a3(i) .ne. 11) call abort end -! { dg-final { cleanup-submodules "a@a_son" } } diff --git a/gcc/testsuite/gfortran.dg/submodule_2.f08 b/gcc/testsuite/gfortran.dg/submodule_2.f08 index 60925ec788d..43456d5fc4c 100644 --- a/gcc/testsuite/gfortran.dg/submodule_2.f08 +++ b/gcc/testsuite/gfortran.dg/submodule_2.f08 @@ -98,5 +98,3 @@ if (any (arg%greeting .ne. ["adieu, people!", "adieu, people!"])) call abort contains end program -! { dg-final { cleanup-submodules "foo_interface@foo_interface_son" } } -! { dg-final { cleanup-submodules "foo_interface@foo_interface_daughter" } } diff --git a/gcc/testsuite/gfortran.dg/submodule_5.f08 b/gcc/testsuite/gfortran.dg/submodule_5.f08 index 2698000c46a..ed5722ed167 100644 --- a/gcc/testsuite/gfortran.dg/submodule_5.f08 +++ b/gcc/testsuite/gfortran.dg/submodule_5.f08 @@ -57,4 +57,3 @@ contains end SUBMODULE foo_interface_daughter end -! { dg-final { cleanup-submodules "foo_interface@foo_interface_daughter" } } diff --git a/gcc/testsuite/gfortran.dg/submodule_6.f08 b/gcc/testsuite/gfortran.dg/submodule_6.f08 index 21b0e0faac5..ec9dfa9e725 100644 --- a/gcc/testsuite/gfortran.dg/submodule_6.f08 +++ b/gcc/testsuite/gfortran.dg/submodule_6.f08 @@ -92,6 +92,3 @@ program p call p_a(a, create_b([3,4,5])) call print(a) end program p -! { dg-final { cleanup-submodules "mod_a@imp_p_a" } } -! { dg-final { cleanup-submodules "mod_b@imp_create" } } - diff --git a/gcc/testsuite/gfortran.dg/submodule_7.f08 b/gcc/testsuite/gfortran.dg/submodule_7.f08 index a183f50e46c..fd1bee6296c 100644 --- a/gcc/testsuite/gfortran.dg/submodule_7.f08 +++ b/gcc/testsuite/gfortran.dg/submodule_7.f08 @@ -145,5 +145,3 @@ program main call verify_cleanup (c_1, c_2) !... end program main -! { dg-final { cleanup-submodules "color_points@color_points_a" } } -! { dg-final { cleanup-submodules "color_points@color_points_b" } } diff --git a/gcc/testsuite/gfortran.dg/submodule_8.f08 b/gcc/testsuite/gfortran.dg/submodule_8.f08 index 15a38a58833..b3c1565bbd8 100644 --- a/gcc/testsuite/gfortran.dg/submodule_8.f08 +++ b/gcc/testsuite/gfortran.dg/submodule_8.f08 @@ -41,4 +41,3 @@ program a_s call abort end if end program -! { dg-final { cleanup-submodules "mod_a@mod_s" } } diff --git a/gcc/testsuite/gfortran.dg/submodule_9.f08 b/gcc/testsuite/gfortran.dg/submodule_9.f08 index 873979d1feb..4589ebcd6d2 100644 --- a/gcc/testsuite/gfortran.dg/submodule_9.f08 +++ b/gcc/testsuite/gfortran.dg/submodule_9.f08 @@ -38,4 +38,3 @@ program a_s implicit none call p() end program -! { dg-final { cleanup-submodules "mod_a@b" } } diff --git a/gcc/testsuite/gfortran.dg/transfer_class_2.f90 b/gcc/testsuite/gfortran.dg/transfer_class_2.f90 index d75b640f10f..476eaccc709 100644 --- a/gcc/testsuite/gfortran.dg/transfer_class_2.f90 +++ b/gcc/testsuite/gfortran.dg/transfer_class_2.f90 @@ -41,5 +41,3 @@ program p if (c%i /= 4) call abort() end - -! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_assignment_7.f90 b/gcc/testsuite/gfortran.dg/typebound_assignment_7.f90 index 2c5b837d670..e297d9f8ddf 100644 --- a/gcc/testsuite/gfortran.dg/typebound_assignment_7.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_assignment_7.f90 @@ -62,5 +62,3 @@ program test_assign end select end - -! { dg-final { cleanup-modules "mod1 mod2" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_call_24.f03 b/gcc/testsuite/gfortran.dg/typebound_call_24.f03 index 48d63dc6023..45990aebe41 100644 --- a/gcc/testsuite/gfortran.dg/typebound_call_24.f03 +++ b/gcc/testsuite/gfortran.dg/typebound_call_24.f03 @@ -20,5 +20,3 @@ program bug2 class(aqq_t) :: aqq ! { dg-error "must be dummy, allocatable or pointer" } call aqq%aqq_init end program - -! { dg-final { cleanup-modules "aqq_m" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_call_25.f90 b/gcc/testsuite/gfortran.dg/typebound_call_25.f90 index df81c79e627..7f5fb07f9aa 100644 --- a/gcc/testsuite/gfortran.dg/typebound_call_25.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_call_25.f90 @@ -34,5 +34,3 @@ CONTAINS END SUBROUTINE END MODULE - -! { dg-final { cleanup-modules "my_mod" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_deferred_1.f90 b/gcc/testsuite/gfortran.dg/typebound_deferred_1.f90 index 6e6dc52d0fd..a08e5343b7d 100644 --- a/gcc/testsuite/gfortran.dg/typebound_deferred_1.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_deferred_1.f90 @@ -19,5 +19,3 @@ contains end subroutine inter end module m - -! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_generic_12.f03 b/gcc/testsuite/gfortran.dg/typebound_generic_12.f03 index 061a41a07f3..c9d0fe0b5de 100644 --- a/gcc/testsuite/gfortran.dg/typebound_generic_12.f03 +++ b/gcc/testsuite/gfortran.dg/typebound_generic_12.f03 @@ -22,5 +22,3 @@ contains class(t) :: this end subroutine sub2 end module m - -! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_generic_13.f03 b/gcc/testsuite/gfortran.dg/typebound_generic_13.f03 index c2116e965a8..eff919e9328 100644 --- a/gcc/testsuite/gfortran.dg/typebound_generic_13.f03 +++ b/gcc/testsuite/gfortran.dg/typebound_generic_13.f03 @@ -24,5 +24,3 @@ contains end subroutine end module - -! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_generic_14.f03 b/gcc/testsuite/gfortran.dg/typebound_generic_14.f03 index 8515cf4378f..8fd2a59578e 100644 --- a/gcc/testsuite/gfortran.dg/typebound_generic_14.f03 +++ b/gcc/testsuite/gfortran.dg/typebound_generic_14.f03 @@ -23,5 +23,3 @@ contains end subroutine end module - -! { dg-final { cleanup-modules "a_mod" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_generic_15.f90 b/gcc/testsuite/gfortran.dg/typebound_generic_15.f90 index f71ffd9e8a7..2cff16d1995 100644 --- a/gcc/testsuite/gfortran.dg/typebound_generic_15.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_generic_15.f90 @@ -14,5 +14,3 @@ module Objects end Type end module - -! { dg-final { cleanup-modules "Objects" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_operator_16.f03 b/gcc/testsuite/gfortran.dg/typebound_operator_16.f03 index eff43ebe53b..f56301cfd15 100644 --- a/gcc/testsuite/gfortran.dg/typebound_operator_16.f03 +++ b/gcc/testsuite/gfortran.dg/typebound_operator_16.f03 @@ -45,5 +45,3 @@ contains myadd = a%x + b end function MyAdd end module - -! { dg-final { cleanup-modules "M1 M2" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_operator_18.f90 b/gcc/testsuite/gfortran.dg/typebound_operator_18.f90 index d5ac9e97533..1288ef50d42 100644 --- a/gcc/testsuite/gfortran.dg/typebound_operator_18.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_operator_18.f90 @@ -21,5 +21,3 @@ contains class(athlete) ,intent(in) :: this end function end module - -! { dg-final { cleanup-modules "athlete_module" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_operator_20.f90 b/gcc/testsuite/gfortran.dg/typebound_operator_20.f90 index 26c49a188eb..81fe7744a85 100644 --- a/gcc/testsuite/gfortran.dg/typebound_operator_20.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_operator_20.f90 @@ -49,5 +49,3 @@ program drive if (h1%sum(h2) /= 1) call abort() end - -! { dg-final { cleanup-modules "overwrite" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_override_3.f90 b/gcc/testsuite/gfortran.dg/typebound_override_3.f90 index 36d84737e18..c3ca5e355cf 100644 --- a/gcc/testsuite/gfortran.dg/typebound_override_3.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_override_3.f90 @@ -30,5 +30,3 @@ contains name = "name_B" end function end module - -! { dg-final { cleanup-modules "dtAs dtBs" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_override_4.f90 b/gcc/testsuite/gfortran.dg/typebound_override_4.f90 index 95131dea3b8..63464526352 100644 --- a/gcc/testsuite/gfortran.dg/typebound_override_4.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_override_4.f90 @@ -30,5 +30,3 @@ contains class(r_type) :: mapout end subroutine end module - -! { dg-final { cleanup-modules "base_mod r_mod" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_override_5.f90 b/gcc/testsuite/gfortran.dg/typebound_override_5.f90 index 565dd48d4fd..fc48fccb648 100644 --- a/gcc/testsuite/gfortran.dg/typebound_override_5.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_override_5.f90 @@ -1,40 +1,38 @@ -! { dg-do compile } -! -! PR 54190: TYPE(*)/assumed-rank: Type/rank check too relaxed for dummy procedure -! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check -! -! Contributed by Tobias Burnus - -module base_mod - implicit none - type base_type - integer :: kind - contains - procedure, pass(map) :: clone => base_clone - end type -contains - subroutine base_clone(map,mapout,info) - class(base_type), intent(inout) :: map - class(base_type), intent(inout) :: mapout - integer :: info - end subroutine -end module - -module r_mod - use base_mod - implicit none - type, extends(base_type) :: r_type - real :: dat - contains - procedure, pass(map) :: clone => r_clone ! { dg-error "Type mismatch in argument" } - end type -contains - subroutine r_clone(map,mapout,info) - class(r_type), intent(inout) :: map -!gcc$ attributes no_arg_check :: mapout - integer, intent(inout) :: mapout - integer :: info - end subroutine -end module - -! { dg-final { cleanup-modules "base_mod r_mod" } } +! { dg-do compile } +! +! PR 54190: TYPE(*)/assumed-rank: Type/rank check too relaxed for dummy procedure +! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check +! +! Contributed by Tobias Burnus + +module base_mod + implicit none + type base_type + integer :: kind + contains + procedure, pass(map) :: clone => base_clone + end type +contains + subroutine base_clone(map,mapout,info) + class(base_type), intent(inout) :: map + class(base_type), intent(inout) :: mapout + integer :: info + end subroutine +end module + +module r_mod + use base_mod + implicit none + type, extends(base_type) :: r_type + real :: dat + contains + procedure, pass(map) :: clone => r_clone ! { dg-error "Type mismatch in argument" } + end type +contains + subroutine r_clone(map,mapout,info) + class(r_type), intent(inout) :: map +!gcc$ attributes no_arg_check :: mapout + integer, intent(inout) :: mapout + integer :: info + end subroutine +end module diff --git a/gcc/testsuite/gfortran.dg/typebound_override_6.f90 b/gcc/testsuite/gfortran.dg/typebound_override_6.f90 index 45720fd610f..55d4002ce17 100644 --- a/gcc/testsuite/gfortran.dg/typebound_override_6.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_override_6.f90 @@ -1,39 +1,37 @@ -! { dg-do compile } -! -! PR 54190: TYPE(*)/assumed-rank: Type/rank check too relaxed for dummy procedure -! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check -! -! Contributed by Tobias Burnus - -module base_mod - implicit none - type base_type - integer :: kind - contains - procedure, pass(map) :: clone => base_clone - end type -contains - subroutine base_clone(map,mapout,info) - class(base_type), intent(inout) :: map - class(base_type), intent(inout) :: mapout - integer :: info - end subroutine -end module - -module r_mod - use base_mod - implicit none - type, extends(base_type) :: r_type - real :: dat - contains - procedure, pass(map) :: clone => r_clone ! { dg-error "Rank mismatch in argument" } - end type -contains - subroutine r_clone(map,mapout,info) - class(r_type), intent(inout) :: map - class(base_type), intent(inout) :: mapout(..) - integer :: info - end subroutine -end module - -! { dg-final { cleanup-modules "base_mod r_mod" } } +! { dg-do compile } +! +! PR 54190: TYPE(*)/assumed-rank: Type/rank check too relaxed for dummy procedure +! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check +! +! Contributed by Tobias Burnus + +module base_mod + implicit none + type base_type + integer :: kind + contains + procedure, pass(map) :: clone => base_clone + end type +contains + subroutine base_clone(map,mapout,info) + class(base_type), intent(inout) :: map + class(base_type), intent(inout) :: mapout + integer :: info + end subroutine +end module + +module r_mod + use base_mod + implicit none + type, extends(base_type) :: r_type + real :: dat + contains + procedure, pass(map) :: clone => r_clone ! { dg-error "Rank mismatch in argument" } + end type +contains + subroutine r_clone(map,mapout,info) + class(r_type), intent(inout) :: map + class(base_type), intent(inout) :: mapout(..) + integer :: info + end subroutine +end module diff --git a/gcc/testsuite/gfortran.dg/typebound_override_7.f90 b/gcc/testsuite/gfortran.dg/typebound_override_7.f90 index 0c7c48ad566..6f75115df5b 100644 --- a/gcc/testsuite/gfortran.dg/typebound_override_7.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_override_7.f90 @@ -1,39 +1,37 @@ -! { dg-do compile } -! -! PR 54190: TYPE(*)/assumed-rank: Type/rank check too relaxed for dummy procedure -! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check -! -! Contributed by Tobias Burnus - -module base_mod - implicit none - type base_type - integer :: kind - contains - procedure, pass(map) :: clone => base_clone - end type -contains - subroutine base_clone(map,mapout,info) - class(base_type), intent(inout) :: map - class(base_type), intent(inout) :: mapout - integer :: info - end subroutine -end module - -module r_mod - use base_mod - implicit none - type, extends(base_type) :: r_type - real :: dat - contains - procedure, pass(map) :: clone => r_clone ! { dg-error "Type mismatch in argument" } - end type -contains - subroutine r_clone(map,mapout,info) - class(r_type), intent(inout) :: map - type(*), intent(inout) :: mapout - integer :: info - end subroutine -end module - -! { dg-final { cleanup-modules "base_mod r_mod" } } +! { dg-do compile } +! +! PR 54190: TYPE(*)/assumed-rank: Type/rank check too relaxed for dummy procedure +! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check +! +! Contributed by Tobias Burnus + +module base_mod + implicit none + type base_type + integer :: kind + contains + procedure, pass(map) :: clone => base_clone + end type +contains + subroutine base_clone(map,mapout,info) + class(base_type), intent(inout) :: map + class(base_type), intent(inout) :: mapout + integer :: info + end subroutine +end module + +module r_mod + use base_mod + implicit none + type, extends(base_type) :: r_type + real :: dat + contains + procedure, pass(map) :: clone => r_clone ! { dg-error "Type mismatch in argument" } + end type +contains + subroutine r_clone(map,mapout,info) + class(r_type), intent(inout) :: map + type(*), intent(inout) :: mapout + integer :: info + end subroutine +end module diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_28.f03 b/gcc/testsuite/gfortran.dg/typebound_proc_28.f03 index 74199c343fa..04d97f80641 100644 --- a/gcc/testsuite/gfortran.dg/typebound_proc_28.f03 +++ b/gcc/testsuite/gfortran.dg/typebound_proc_28.f03 @@ -26,5 +26,3 @@ contains end function end module - -! { dg-final { cleanup-modules "t" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_29.f90 b/gcc/testsuite/gfortran.dg/typebound_proc_29.f90 index 2650d149368..3e9a9aab634 100644 --- a/gcc/testsuite/gfortran.dg/typebound_proc_29.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_proc_29.f90 @@ -22,5 +22,3 @@ program abstract type(pdf) pp print pp%getx() ! { dg-error "must be of type default-kind CHARACTER or of INTEGER" } end program - -! { dg-final { cleanup-modules "pdfs" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_30.f90 b/gcc/testsuite/gfortran.dg/typebound_proc_30.f90 index 09b07261089..5fa5a0fac00 100644 --- a/gcc/testsuite/gfortran.dg/typebound_proc_30.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_proc_30.f90 @@ -34,5 +34,3 @@ contains end function end module - -! { dg-final { cleanup-modules "phs_single" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_31.f90 b/gcc/testsuite/gfortran.dg/typebound_proc_31.f90 index d83a9cdb4d0..82a67c08417 100644 --- a/gcc/testsuite/gfortran.dg/typebound_proc_31.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_proc_31.f90 @@ -24,5 +24,3 @@ contains end function end module - -! { dg-final { cleanup-modules "classes" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_32.f90 b/gcc/testsuite/gfortran.dg/typebound_proc_32.f90 index 00ae9c73263..035965be426 100644 --- a/gcc/testsuite/gfortran.dg/typebound_proc_32.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_proc_32.f90 @@ -31,5 +31,3 @@ contains end function end module - -! { dg-final { cleanup-modules "classes" } } diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_33.f90 b/gcc/testsuite/gfortran.dg/typebound_proc_33.f90 index 68ea53fcd11..41aef56cb03 100644 --- a/gcc/testsuite/gfortran.dg/typebound_proc_33.f90 +++ b/gcc/testsuite/gfortran.dg/typebound_proc_33.f90 @@ -35,5 +35,3 @@ contains end subroutine end - -! { dg-final { cleanup-modules "ObjectLists" } } diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_16.f90 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_16.f90 index 99e186d5c14..2be8848c11f 100644 --- a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_16.f90 +++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_16.f90 @@ -20,5 +20,3 @@ contains end subroutine end module - -! { dg-final { cleanup-modules "IO" } } diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_19.f90 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_19.f90 index 51359d1461c..a665a3829ff 100644 --- a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_19.f90 +++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_19.f90 @@ -49,5 +49,3 @@ CONTAINS END SELECT; END SELECT END SUBROUTINE copy_int END PROGRAM main - -! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_24.f03 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_24.f03 index 2abe99cd5bb..39937277323 100644 --- a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_24.f03 +++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_24.f03 @@ -214,5 +214,3 @@ program main end select end do end program main - -! { dg-final { cleanup-modules "list_mod link_mod" } } diff --git a/gcc/testsuite/gfortran.dg/use_only_3.f90 b/gcc/testsuite/gfortran.dg/use_only_3.f90 index ebb39289fc4..b264506d4c3 100644 --- a/gcc/testsuite/gfortran.dg/use_only_3.f90 +++ b/gcc/testsuite/gfortran.dg/use_only_3.f90 @@ -32,4 +32,3 @@ subroutine dforceb(c0, i, betae, ipol, bec0, ctabin, gqq, gqqm, qmat, dq2, df) & dq2, gmes end subroutine dforceb -! { dg-final { cleanup-modules "cell_base constants control_flags cvan electrons_base electrons_nose gvecs gvecw ions_base kinds parameters" } } diff --git a/gcc/testsuite/gfortran.dg/use_without_only_1.f90 b/gcc/testsuite/gfortran.dg/use_without_only_1.f90 index 3fea702c2a4..06af9853933 100644 --- a/gcc/testsuite/gfortran.dg/use_without_only_1.f90 +++ b/gcc/testsuite/gfortran.dg/use_without_only_1.f90 @@ -19,4 +19,3 @@ CONTAINS USE ISO_C_BINDING ! { dg-warning "9:has no ONLY qualifier" } END SUBROUTINE S3 END MODULE -! { dg-final { cleanup-modules "foo testmod" } } diff --git a/gcc/testsuite/gfortran.dg/warn_unused_function.f90 b/gcc/testsuite/gfortran.dg/warn_unused_function.f90 index 4d0ed9abc92..209cb7f0026 100644 --- a/gcc/testsuite/gfortran.dg/warn_unused_function.f90 +++ b/gcc/testsuite/gfortran.dg/warn_unused_function.f90 @@ -17,5 +17,3 @@ contains print *, "Hello ", a, "!" end subroutine end module - -! { dg-final { cleanup-modules "mod_say_hello" } } diff --git a/gcc/testsuite/gfortran.dg/warn_unused_function_2.f90 b/gcc/testsuite/gfortran.dg/warn_unused_function_2.f90 index 958cc969253..43b211e57bf 100644 --- a/gcc/testsuite/gfortran.dg/warn_unused_function_2.f90 +++ b/gcc/testsuite/gfortran.dg/warn_unused_function_2.f90 @@ -39,5 +39,3 @@ contains subroutine s5 ! { dg-warning "defined but not used" } end subroutine end - -! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/lib/fortran-modules.exp b/gcc/testsuite/lib/fortran-modules.exp index 7bfc0025a8a..a35f7a7abde 100644 --- a/gcc/testsuite/lib/fortran-modules.exp +++ b/gcc/testsuite/lib/fortran-modules.exp @@ -79,10 +79,14 @@ proc list-module-names { files } { proc list-module-names-1 { file } { set result {} - set tmp [grep $file "^\[ \t\]*((#)?\[ \t\]*include|\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\](?!\[ \t\]+\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+))\[ \t\]+.*" line] + if {[file isdirectory $file]} {return} + # Find lines containing INCLUDE, MODULE, and SUBMODULE, excluding the lines containing + # MODULE [PURE|(IMPURE\s+)?ELEMENTAL|RECURSIVE] (PROCEDURE|FUNCTION|SUBROUTINE) + set pat {^\s*((#)?\s*include|(sub)?module(?!\s+((pure|(impure\s+)?elemental|recursive)\s+)?(procedure|function|subroutine)[:\s]+))\s*.*} + set tmp [igrep $file $pat line] if {![string match "" $tmp]} { foreach i $tmp { - regexp "(\[0-9\]+)\[ \t\]+(?:(?:#)?\[ \t\]*include\[ \t\]+)\[\"\](\[^\"\]*)\[\"\]" $i dummy lineno include_file + regexp -nocase {(\d+)\s+#?\s*include\s+["']([^"']*)["']} $i dummy lineno include_file if {[info exists include_file]} { set dir [file dirname $file] set inc "$dir/$include_file" @@ -99,10 +103,16 @@ proc list-module-names-1 { file } { } continue } - regexp "(\[0-9\]+)\[ \t\]+(?:(\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\]\[ \t\]+(?!\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+)))(\[^ \t;\]*)" $i i lineno keyword mod - if {![info exists lineno]} { + regexp -nocase {(\d+)\s+(module|submodule)\s*([^;]*)} $i i lineno keyword mod + if {![info exists mod]} { continue } + # Generates the file name mod_name@submod_name from + # (\s*mod_name[:submod_name]\s*)\s*submod_name\s*[! comment] + regsub {\s*!.*} $mod "" mod + regsub {:[^)]*} $mod "" mod + regsub {\(\s*} $mod "" mod + regsub {\s*\)\s*} $mod "@" mod verbose "Line $lineno mentions module `$mod'" 3 if {[lsearch $result $mod] < 0} { lappend result $mod @@ -111,3 +121,54 @@ proc list-module-names-1 { file } { } return $result } + +# Looks for case insensitive occurrences of a string in a file. +# return:list of lines that matched or NULL if none match. +# args: first arg is the filename, +# second is the pattern, +# third are any options. +# Options: line - puts line numbers of match in list +# +proc igrep { args } { + + set file [lindex $args 0] + set pattern [lindex $args 1] + + verbose "Grepping $file for the pattern \"$pattern\"" 3 + + set argc [llength $args] + if { $argc > 2 } { + for { set i 2 } { $i < $argc } { incr i } { + append options [lindex $args $i] + append options " " + } + } else { + set options "" + } + + set i 0 + set fd [open $file r] + while { [gets $fd cur_line]>=0 } { + incr i + if {[regexp -nocase -- "$pattern" $cur_line match]} { + if {![string match "" $options]} { + foreach opt $options { + switch $opt { + "line" { + lappend grep_out [concat $i $match] + } + } + } + } else { + lappend grep_out $match + } + } + } + close $fd + unset fd + unset i + if {![info exists grep_out]} { + set grep_out "" + } + return $grep_out +} -- 2.30.2