Index: gfortran.dg/func_derived_4.f90 =================================================================== --- gfortran.dg/func_derived_4.f90 (revision 123170) +++ gfortran.dg/func_derived_4.f90 (working copy) @@ -102,4 +102,4 @@ mshp => msh_(quality) end program test_pnt -! { dg-final { cleanup-modules "class_mesh class_scalar_field class_mesh" } } +! { dg-final { cleanup-modules "class_mesh class_field class_scalar_field" } } Index: gfortran.dg/gomp/appendix-a/a.22.4.f90 =================================================================== --- gfortran.dg/gomp/appendix-a/a.22.4.f90 (revision 123170) +++ gfortran.dg/gomp/appendix-a/a.22.4.f90 (working copy) @@ -9,3 +9,4 @@ !$OMP THREADPRIVATE(/T/) ! { dg-error "COMMON block" } !non-conforming because /T/ not declared in A22_4_WRONG END SUBROUTINE A22_4_WRONG +! { dg-final { cleanup-modules "A22_MODULE" } } Index: gfortran.dg/gomp/appendix-a/a.26.2.f90 =================================================================== --- gfortran.dg/gomp/appendix-a/a.26.2.f90 (revision 123170) +++ gfortran.dg/gomp/appendix-a/a.26.2.f90 (working copy) @@ -20,3 +20,4 @@ !$OMP END PARALLEL DO END SUBROUTINE F END MODULE A26_2 +! { dg-final { cleanup-modules "A26_2" } } Index: gfortran.dg/gomp/appendix-a/a.32.1.f90 =================================================================== --- gfortran.dg/gomp/appendix-a/a.32.1.f90 (revision 123170) +++ gfortran.dg/gomp/appendix-a/a.32.1.f90 (working copy) @@ -22,3 +22,4 @@ ALLOCATE(WORK(SIZE)) WORK = TOL END SUBROUTINE BUILD +! { dg-final { cleanup-modules "M" } } Index: gfortran.dg/overload_1.f90 =================================================================== --- gfortran.dg/overload_1.f90 (revision 123170) +++ gfortran.dg/overload_1.f90 (working copy) @@ -181,3 +181,4 @@ & abort end subroutine checku end program main +! { dg-final { cleanup-modules "m" } } Index: gfortran.dg/impure_assignment_1.f90 =================================================================== --- gfortran.dg/impure_assignment_1.f90 (revision 123170) +++ gfortran.dg/impure_assignment_1.f90 (working copy) @@ -23,4 +23,6 @@ TYPE(T1), INTENT(IN) :: J I=J ! { dg-error "must be PURE" } END SUBROUTINE S2 -END \ No newline at end of file +END +! { dg-final { cleanup-modules "M1" } } + Index: gfortran.dg/private_type_5.f90 =================================================================== --- gfortran.dg/private_type_5.f90 (revision 123170) +++ gfortran.dg/private_type_5.f90 (working copy) @@ -21,4 +21,5 @@ ir%i = i end subroutine init end subroutine sub -end module test \ No newline at end of file +end module test +! { dg-final { cleanup-modules "test" } } Index: gfortran.dg/error_recovery_3.f90 =================================================================== --- gfortran.dg/error_recovery_3.f90 (revision 123170) +++ gfortran.dg/error_recovery_3.f90 (working copy) @@ -6,4 +6,6 @@ INTEGER :: I END MODULE M1 -USE M1, ONLY: I,&! { dg-error "Missing" } \ No newline at end of file +USE M1, ONLY: I,&! { dg-error "Missing" } +! { dg-final { cleanup-modules "M1" } } + Index: gfortran.dg/alloc_comp_basics_1.f90 =================================================================== --- gfortran.dg/alloc_comp_basics_1.f90 (revision 123170) +++ gfortran.dg/alloc_comp_basics_1.f90 (working copy) @@ -141,3 +141,4 @@ end program alloc ! { dg-final { scan-tree-dump-times "deallocate" 33 "original" } } ! { dg-final { cleanup-tree-dump "original" } } +! { dg-final { cleanup-modules "alloc_m" } } Index: gfortran.dg/interface_3.f90 =================================================================== --- gfortran.dg/interface_3.f90 (revision 123170) +++ gfortran.dg/interface_3.f90 (working copy) @@ -66,4 +66,4 @@ print *, my_fun (a) ! { dg-error "ambiguous reference" } end subroutine his_fun -! { dg-final { cleanup-modules "test_mod" } } +! { dg-final { cleanup-modules "test_mod test_mod2" } } Index: gfortran.dg/sequence_types_1.f90 =================================================================== --- gfortran.dg/sequence_types_1.f90 (revision 123170) +++ gfortran.dg/sequence_types_1.f90 (working copy) @@ -77,3 +77,4 @@ Integer(kindInt), dimension(:), pointer :: subset end type GroupDefLL end module data_types +! { dg-final { cleanup-modules "data_types" } } Index: gfortran.dg/protected_4.f90 =================================================================== --- gfortran.dg/protected_4.f90 (revision 123170) +++ gfortran.dg/protected_4.f90 (working copy) @@ -55,4 +55,4 @@ protected :: test ! { dg-error "MODULE attribute conflicts with PROTECTED" } end module test -! { dg-final { cleanup-modules "protmod" } } +! { dg-final { cleanup-modules "protmod test" } } Index: gfortran.dg/elemental_result_1.f90 =================================================================== --- gfortran.dg/elemental_result_1.f90 (revision 123170) +++ gfortran.dg/elemental_result_1.f90 (working copy) @@ -18,4 +18,4 @@ INTEGER, pointer :: MM ! { dg-error "conflicts with ELEMENTAL" } END FUNCTION MM END MODULE Test - +! { dg-final { cleanup-modules "Test" } } Index: gfortran.dg/generic_actual_arg.f90 =================================================================== --- gfortran.dg/generic_actual_arg.f90 (revision 123170) +++ gfortran.dg/generic_actual_arg.f90 (working copy) @@ -22,4 +22,5 @@ END SUBROUTINE F() -END SUBROUTINE \ No newline at end of file +END SUBROUTINE +! { dg-final { cleanup-modules "TEST" } } Index: gfortran.dg/internal_references_1.f90 =================================================================== --- gfortran.dg/internal_references_1.f90 (revision 123170) +++ gfortran.dg/internal_references_1.f90 (working copy) @@ -33,4 +33,4 @@ bar = 1.0 end function bar end program test - +! { dg-final { cleanup-modules "m" } } Index: gfortran.dg/present_1.f90 =================================================================== --- gfortran.dg/present_1.f90 (revision 123170) +++ gfortran.dg/present_1.f90 (working copy) @@ -17,4 +17,4 @@ END SUBROUTINE S1 END MODULE END - +! { dg-final { cleanup-modules "M1" } } Index: gfortran.dg/volatile10.f90 =================================================================== --- gfortran.dg/volatile10.f90 (revision 123170) +++ gfortran.dg/volatile10.f90 (working copy) @@ -146,4 +146,4 @@ ! TODO: dg-final { scan-tree-dump-not "main_test2_3" "optimized" } ! { dg-final { scan-tree-dump "main_test2_4" "optimized" } } ! { dg-final { cleanup-tree-dump "optimized" } } -! { dg-final { cleanup-modules "one two" } } +! { dg-final { cleanup-modules "impl one two" } } Index: gfortran.dg/module_equivalence_2.f90 =================================================================== --- gfortran.dg/module_equivalence_2.f90 (revision 123170) +++ gfortran.dg/module_equivalence_2.f90 (working copy) @@ -22,3 +22,4 @@ reM = 0.57d1 if (M .ne. 0.57d1) call abort () end +! { dg-final { cleanup-modules "a b" } } Index: gfortran.dg/use_4.f90 =================================================================== --- gfortran.dg/use_4.f90 (revision 123170) +++ gfortran.dg/use_4.f90 (working copy) @@ -31,3 +31,4 @@ use foo, only: i => foo! { dg-error "been used as an external module name" } use foo, only: foo => i! { dg-error "been used as an external module name" } end program +! { dg-final { cleanup-modules "foo bar test test2 test3" } }