summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJanis Johnson <janis187@us.ibm.com>2006-03-21 23:50:37 +0000
committerJanis Johnson <janis@gcc.gnu.org>2006-03-21 23:50:37 +0000
commitb09940e914ab641917500de355f82b54a7f6d1de (patch)
tree2b1e50d458842ae7d196cc6f8fdd686ff1939221 /gcc
parentd9870b7ef4d6cbc588da427a64b022139df0708d (diff)
downloadgcc-b09940e914ab641917500de355f82b54a7f6d1de.tar.gz
gcc-dg.exp (cleanup-modules): New proc.
* lib/gcc-dg.exp (cleanup-modules): New proc. * gfortran.dg/allocatable_function_1.f90, gfortran.dg/allocate_char_star_scalar_1.f90, gfortran.dg/assumed_charlen_function_1.f90, gfortran.dg/assumed_dummy_1.f90, gfortran.dg/assumed_shape_ranks_1.f90, gfortran.dg/assumed_shape_ranks_2.f90, gfortran.dg/assumed_size_dt_dummy.f90, gfortran.dg/auto_char_dummy_array_1.f90, gfortran.dg/auto_char_len_3.f90, gfortran.dg/automatic_module_variable.f90, gfortran.dg/bad_automatic_objects_1.f90, gfortran.dg/char_array_constructor.f90, gfortran.dg/char_array_structure_constructor.f90, gfortran.dg/char_result_11.f90, gfortran.dg/char_result_9.f90, gfortran.dg/contained_1.f90, gfortran.dg/convert_1.f90, gfortran.dg/cray_pointers_5.f90, gfortran.dg/data_constraints_1.f90, gfortran.dg/default_initialization.f90, gfortran.dg/der_charlen_1.f90, gfortran.dg/der_io_2.f90, gfortran.dg/der_io_3.f90, gfortran.dg/derived_pointer_recursion.f90, gfortran.dg/derived_recursion.f90, gfortran.dg/der_pointer_1.f90, gfortran.dg/der_pointer_3.f90, gfortran.dg/der_pointer_4.f90, gfortran.dg/dummy_functions_1.f90, gfortran.dg/elemental_initializer_1.f90, gfortran.dg/elemental_non_intrinsic_dummy_1.f90, gfortran.dg/elemental_pointer_1.f90, gfortran.dg/elemental_subroutine_1.f90, gfortran.dg/elemental_subroutine_2.f90, gfortran.dg/entry_1.f90, gfortran.dg/entry_3.f90, gfortran.dg/enum_10.f90, gfortran.dg/equiv_constraint_3.f90, gfortran.dg/func_derived_1.f90, gfortran.dg/func_derived_2.f90, gfortran.dg/func_derived_3.f90, gfortran.dg/generic_1.f90, gfortran.dg/generic_2.f90, gfortran.dg/generic_3.f90, gfortran.dg/generic_4.f90, gfortran.dg/global_references_1.f90, gfortran.dg/host_used_types_1.f90, gfortran.dg/implicit_1.f90, gfortran.dg/implicit_2.f90, gfortran.dg/implicit_actual.f90, gfortran.dg/initialization_1.f90, gfortran.dg/int_1.f90, gfortran.dg/intent_used_1.f90, gfortran.dg/interface_1.f90, gfortran.dg/interface_2.f90, gfortran.dg/internal_references_2.f90, gfortran.dg/io_constraints_1.f90, gfortran.dg/io_constraints_2.f90, gfortran.dg/large_integer_kind_1.f90, gfortran.dg/large_real_kind_1.f90, gfortran.dg/module_blank_common.f90, gfortran.dg/module_commons_1.f90, gfortran.dg/module_double_reuse.f90, gfortran.dg/module_equivalence_1.f90, gfortran.dg/module_interface_1.f90, gfortran.dg/module_parameter_array_refs_1.f90, gfortran.dg/named_interface.f90, gfortran.dg/namelist_14.f90, gfortran.dg/namelist_15.f90, gfortran.dg/namelist_1.f90, gfortran.dg/namelist_4.f90, gfortran.dg/namelist_use.f90, gfortran.dg/namelist_use_only.f90, gfortran.dg/nested_modules_1.f90, gfortran.dg/nested_modules_2.f90, gfortran.dg/nested_modules_3.f90, gfortran.dg/nested_modules_4.f90, gfortran.dg/nested_modules_5.f90, gfortran.dg/parens_5.f90, gfortran.dg/parent_result_ref_4.f90, gfortran.dg/pr15164.f90, gfortran.dg/pr16861.f90, gfortran.dg/pr17615.f90, gfortran.dg/pr19926.f90, gfortran.dg/pr21177.f90, gfortran.dg/pr26246_1.f90, gfortran.dg/private_type_1.f90, gfortran.dg/private_type_2.f90, gfortran.dg/private_type_3.f90, gfortran.dg/private_type_4.f90, gfortran.dg/procedure_lvalue.f90, gfortran.dg/pure_byref_3.f90, gfortran.dg/same_name_1.f90, gfortran.dg/sibling_dummy_procedure_1.f90, gfortran.dg/sibling_dummy_procedure_2.f90, gfortran.dg/sibling_dummy_procedure_3.f90, gfortran.dg/substr_1.f90, gfortran.dg/substring_equivalence.f90, gfortran.dg/use_allocated_1.f90, gfortran.dg/used_dummy_types_1.f90, gfortran.dg/used_dummy_types_2.f90, gfortran.dg/used_dummy_types_3.f90, gfortran.dg/used_dummy_types_4.f90, gfortran.dg/used_dummy_types_5.f90, gfortran.dg/used_interface_ref.f90, gfortran.dg/used_types_1.f90, gfortran.dg/userdef_operator_1.f90: Use it. From-SVN: r112264
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog75
-rw-r--r--gcc/testsuite/gfortran.dg/allocatable_function_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/allocate_char_star_scalar_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/assumed_charlen_function_1.f901
-rw-r--r--gcc/testsuite/gfortran.dg/assumed_dummy_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/assumed_shape_ranks_1.f901
-rw-r--r--gcc/testsuite/gfortran.dg/assumed_shape_ranks_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/assumed_size_dt_dummy.f901
-rw-r--r--gcc/testsuite/gfortran.dg/auto_char_dummy_array_1.f901
-rw-r--r--gcc/testsuite/gfortran.dg/auto_char_len_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/automatic_module_variable.f902
-rw-r--r--gcc/testsuite/gfortran.dg/bad_automatic_objects_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/char_array_constructor.f901
-rw-r--r--gcc/testsuite/gfortran.dg/char_array_structure_constructor.f902
-rw-r--r--gcc/testsuite/gfortran.dg/char_result_11.f902
-rw-r--r--gcc/testsuite/gfortran.dg/char_result_9.f902
-rw-r--r--gcc/testsuite/gfortran.dg/contained_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/convert_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/cray_pointers_5.f902
-rw-r--r--gcc/testsuite/gfortran.dg/data_constraints_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/default_initialization.f902
-rw-r--r--gcc/testsuite/gfortran.dg/der_charlen_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/der_io_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/der_io_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/der_pointer_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/der_pointer_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/der_pointer_4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/derived_pointer_recursion.f901
-rw-r--r--gcc/testsuite/gfortran.dg/derived_recursion.f902
-rw-r--r--gcc/testsuite/gfortran.dg/dummy_functions_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/elemental_initializer_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/elemental_non_intrinsic_dummy_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/elemental_pointer_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/elemental_subroutine_1.f904
-rw-r--r--gcc/testsuite/gfortran.dg/elemental_subroutine_2.f904
-rw-r--r--gcc/testsuite/gfortran.dg/entry_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/entry_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/enum_10.f902
-rw-r--r--gcc/testsuite/gfortran.dg/equiv_constraint_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/func_derived_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/func_derived_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/func_derived_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/generic_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/generic_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/generic_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/generic_4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/global_references_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/host_used_types_1.f904
-rw-r--r--gcc/testsuite/gfortran.dg/implicit_1.f901
-rw-r--r--gcc/testsuite/gfortran.dg/implicit_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/implicit_actual.f901
-rw-r--r--gcc/testsuite/gfortran.dg/initialization_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/int_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/intent_used_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/interface_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/interface_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/internal_references_2.f904
-rw-r--r--gcc/testsuite/gfortran.dg/io_constraints_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/io_constraints_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/large_integer_kind_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/large_real_kind_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/module_blank_common.f902
-rw-r--r--gcc/testsuite/gfortran.dg/module_commons_1.f901
-rw-r--r--gcc/testsuite/gfortran.dg/module_double_reuse.f901
-rw-r--r--gcc/testsuite/gfortran.dg/module_equivalence_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/module_interface_1.f904
-rw-r--r--gcc/testsuite/gfortran.dg/module_parameter_array_refs_1.f901
-rw-r--r--gcc/testsuite/gfortran.dg/named_interface.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_14.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_15.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_4.f901
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_use.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_use_only.f902
-rw-r--r--gcc/testsuite/gfortran.dg/nested_modules_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/nested_modules_2.f901
-rw-r--r--gcc/testsuite/gfortran.dg/nested_modules_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/nested_modules_4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/nested_modules_5.f902
-rw-r--r--gcc/testsuite/gfortran.dg/parens_5.f902
-rw-r--r--gcc/testsuite/gfortran.dg/parent_result_ref_4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr15164.f901
-rw-r--r--gcc/testsuite/gfortran.dg/pr16861.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr17615.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr19926.f901
-rw-r--r--gcc/testsuite/gfortran.dg/pr21177.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr26246_1.f901
-rw-r--r--gcc/testsuite/gfortran.dg/private_type_1.f901
-rw-r--r--gcc/testsuite/gfortran.dg/private_type_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/private_type_3.f901
-rw-r--r--gcc/testsuite/gfortran.dg/private_type_4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/procedure_lvalue.f904
-rw-r--r--gcc/testsuite/gfortran.dg/pure_byref_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/same_name_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/sibling_dummy_procedure_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/sibling_dummy_procedure_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/sibling_dummy_procedure_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/substr_1.f901
-rw-r--r--gcc/testsuite/gfortran.dg/substring_equivalence.f902
-rw-r--r--gcc/testsuite/gfortran.dg/use_allocated_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/used_dummy_types_1.f904
-rw-r--r--gcc/testsuite/gfortran.dg/used_dummy_types_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/used_dummy_types_3.f901
-rw-r--r--gcc/testsuite/gfortran.dg/used_dummy_types_4.f901
-rw-r--r--gcc/testsuite/gfortran.dg/used_dummy_types_5.f901
-rw-r--r--gcc/testsuite/gfortran.dg/used_interface_ref.f903
-rw-r--r--gcc/testsuite/gfortran.dg/used_types_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/userdef_operator_1.f901
-rw-r--r--gcc/testsuite/lib/gcc-dg.exp7
109 files changed, 271 insertions, 17 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9b38f2c2080..6f3eef02a13 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,78 @@
+2006-03-21 Janis Johnson <janis187@us.ibm.com>
+
+ * lib/gcc-dg.exp (cleanup-modules): New proc.
+ * gfortran.dg/allocatable_function_1.f90,
+ gfortran.dg/allocate_char_star_scalar_1.f90,
+ gfortran.dg/assumed_charlen_function_1.f90,
+ gfortran.dg/assumed_dummy_1.f90,
+ gfortran.dg/assumed_shape_ranks_1.f90,
+ gfortran.dg/assumed_shape_ranks_2.f90,
+ gfortran.dg/assumed_size_dt_dummy.f90,
+ gfortran.dg/auto_char_dummy_array_1.f90,
+ gfortran.dg/auto_char_len_3.f90,
+ gfortran.dg/automatic_module_variable.f90,
+ gfortran.dg/bad_automatic_objects_1.f90,
+ gfortran.dg/char_array_constructor.f90,
+ gfortran.dg/char_array_structure_constructor.f90,
+ gfortran.dg/char_result_11.f90, gfortran.dg/char_result_9.f90,
+ gfortran.dg/contained_1.f90, gfortran.dg/convert_1.f90,
+ gfortran.dg/cray_pointers_5.f90, gfortran.dg/data_constraints_1.f90,
+ gfortran.dg/default_initialization.f90, gfortran.dg/der_charlen_1.f90,
+ gfortran.dg/der_io_2.f90, gfortran.dg/der_io_3.f90,
+ gfortran.dg/derived_pointer_recursion.f90,
+ gfortran.dg/derived_recursion.f90, gfortran.dg/der_pointer_1.f90,
+ gfortran.dg/der_pointer_3.f90, gfortran.dg/der_pointer_4.f90,
+ gfortran.dg/dummy_functions_1.f90,
+ gfortran.dg/elemental_initializer_1.f90,
+ gfortran.dg/elemental_non_intrinsic_dummy_1.f90,
+ gfortran.dg/elemental_pointer_1.f90,
+ gfortran.dg/elemental_subroutine_1.f90,
+ gfortran.dg/elemental_subroutine_2.f90, gfortran.dg/entry_1.f90,
+ gfortran.dg/entry_3.f90, gfortran.dg/enum_10.f90,
+ gfortran.dg/equiv_constraint_3.f90, gfortran.dg/func_derived_1.f90,
+ gfortran.dg/func_derived_2.f90, gfortran.dg/func_derived_3.f90,
+ gfortran.dg/generic_1.f90, gfortran.dg/generic_2.f90,
+ gfortran.dg/generic_3.f90, gfortran.dg/generic_4.f90,
+ gfortran.dg/global_references_1.f90,
+ gfortran.dg/host_used_types_1.f90, gfortran.dg/implicit_1.f90,
+ gfortran.dg/implicit_2.f90, gfortran.dg/implicit_actual.f90,
+ gfortran.dg/initialization_1.f90, gfortran.dg/int_1.f90,
+ gfortran.dg/intent_used_1.f90, gfortran.dg/interface_1.f90,
+ gfortran.dg/interface_2.f90, gfortran.dg/internal_references_2.f90,
+ gfortran.dg/io_constraints_1.f90, gfortran.dg/io_constraints_2.f90,
+ gfortran.dg/large_integer_kind_1.f90,
+ gfortran.dg/large_real_kind_1.f90,
+ gfortran.dg/module_blank_common.f90, gfortran.dg/module_commons_1.f90,
+ gfortran.dg/module_double_reuse.f90,
+ gfortran.dg/module_equivalence_1.f90,
+ gfortran.dg/module_interface_1.f90,
+ gfortran.dg/module_parameter_array_refs_1.f90,
+ gfortran.dg/named_interface.f90, gfortran.dg/namelist_14.f90,
+ gfortran.dg/namelist_15.f90, gfortran.dg/namelist_1.f90,
+ gfortran.dg/namelist_4.f90, gfortran.dg/namelist_use.f90,
+ gfortran.dg/namelist_use_only.f90, gfortran.dg/nested_modules_1.f90,
+ gfortran.dg/nested_modules_2.f90, gfortran.dg/nested_modules_3.f90,
+ gfortran.dg/nested_modules_4.f90, gfortran.dg/nested_modules_5.f90,
+ gfortran.dg/parens_5.f90, gfortran.dg/parent_result_ref_4.f90,
+ gfortran.dg/pr15164.f90, gfortran.dg/pr16861.f90,
+ gfortran.dg/pr17615.f90, gfortran.dg/pr19926.f90,
+ gfortran.dg/pr21177.f90, gfortran.dg/pr26246_1.f90,
+ gfortran.dg/private_type_1.f90, gfortran.dg/private_type_2.f90,
+ gfortran.dg/private_type_3.f90, gfortran.dg/private_type_4.f90,
+ gfortran.dg/procedure_lvalue.f90, gfortran.dg/pure_byref_3.f90,
+ gfortran.dg/same_name_1.f90,
+ gfortran.dg/sibling_dummy_procedure_1.f90,
+ gfortran.dg/sibling_dummy_procedure_2.f90,
+ gfortran.dg/sibling_dummy_procedure_3.f90,
+ gfortran.dg/substr_1.f90, gfortran.dg/substring_equivalence.f90,
+ gfortran.dg/use_allocated_1.f90, gfortran.dg/used_dummy_types_1.f90,
+ gfortran.dg/used_dummy_types_2.f90,
+ gfortran.dg/used_dummy_types_3.f90,
+ gfortran.dg/used_dummy_types_4.f90,
+ gfortran.dg/used_dummy_types_5.f90,
+ gfortran.dg/used_interface_ref.f90, gfortran.dg/used_types_1.f90,
+ gfortran.dg/userdef_operator_1.f90: Use it.
+
2006-03-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gfortran.dg/advance.f90, gfortran.dg/backspace_2.f,
diff --git a/gcc/testsuite/gfortran.dg/allocatable_function_1.f90 b/gcc/testsuite/gfortran.dg/allocatable_function_1.f90
index b66d6ae182e..b20ff3d19c0 100644
--- a/gcc/testsuite/gfortran.dg/allocatable_function_1.f90
+++ b/gcc/testsuite/gfortran.dg/allocatable_function_1.f90
@@ -109,4 +109,4 @@ contains
end program alloc_fun
! { dg-final { scan-tree-dump-times "free" 9 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
-
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/allocate_char_star_scalar_1.f90 b/gcc/testsuite/gfortran.dg/allocate_char_star_scalar_1.f90
index 305136cd659..7e6d7d1f0d2 100644
--- a/gcc/testsuite/gfortran.dg/allocate_char_star_scalar_1.f90
+++ b/gcc/testsuite/gfortran.dg/allocate_char_star_scalar_1.f90
@@ -29,3 +29,5 @@ program hum
call foo(q)
end program hum
+
+! { dg-final { cleanup-modules "moo" } }
diff --git a/gcc/testsuite/gfortran.dg/assumed_charlen_function_1.f90 b/gcc/testsuite/gfortran.dg/assumed_charlen_function_1.f90
index c90617dcec0..e10fd70b584 100644
--- a/gcc/testsuite/gfortran.dg/assumed_charlen_function_1.f90
+++ b/gcc/testsuite/gfortran.dg/assumed_charlen_function_1.f90
@@ -81,3 +81,4 @@ end function not_OK
END
+! { dg-final { cleanup-modules "M1 INTEGER_SETS" } }
diff --git a/gcc/testsuite/gfortran.dg/assumed_dummy_1.f90 b/gcc/testsuite/gfortran.dg/assumed_dummy_1.f90
index a160a884b2a..97c163e8c6b 100644
--- a/gcc/testsuite/gfortran.dg/assumed_dummy_1.f90
+++ b/gcc/testsuite/gfortran.dg/assumed_dummy_1.f90
@@ -43,4 +43,4 @@ contains
END SUBROUTINE roo
end program test
-
+! { dg-final { cleanup-modules "global" } }
diff --git a/gcc/testsuite/gfortran.dg/assumed_shape_ranks_1.f90 b/gcc/testsuite/gfortran.dg/assumed_shape_ranks_1.f90
index a7f24ea1bc5..a22a45c109d 100644
--- a/gcc/testsuite/gfortran.dg/assumed_shape_ranks_1.f90
+++ b/gcc/testsuite/gfortran.dg/assumed_shape_ranks_1.f90
@@ -23,3 +23,4 @@ CONTAINS
END SUBROUTINE TST
END
+! { dg-final { cleanup-modules "addon" } }
diff --git a/gcc/testsuite/gfortran.dg/assumed_shape_ranks_2.f90 b/gcc/testsuite/gfortran.dg/assumed_shape_ranks_2.f90
index 641d3d929f4..da59213d91f 100644
--- a/gcc/testsuite/gfortran.dg/assumed_shape_ranks_2.f90
+++ b/gcc/testsuite/gfortran.dg/assumed_shape_ranks_2.f90
@@ -43,3 +43,5 @@ end module mod1
call foo (bar, i)
if (i .ne. 2) call abort ()
end
+
+! { dg-final { cleanup-modules "mod1" } }
diff --git a/gcc/testsuite/gfortran.dg/assumed_size_dt_dummy.f90 b/gcc/testsuite/gfortran.dg/assumed_size_dt_dummy.f90
index 9e9e9b80248..1f45f24ed30 100644
--- a/gcc/testsuite/gfortran.dg/assumed_size_dt_dummy.f90
+++ b/gcc/testsuite/gfortran.dg/assumed_size_dt_dummy.f90
@@ -15,3 +15,4 @@ END MODULE TEST
end
+! { dg-final { cleanup-modules "TEST" } }
diff --git a/gcc/testsuite/gfortran.dg/auto_char_dummy_array_1.f90 b/gcc/testsuite/gfortran.dg/auto_char_dummy_array_1.f90
index 2ee98cfcc80..6ed6f45769f 100644
--- a/gcc/testsuite/gfortran.dg/auto_char_dummy_array_1.f90
+++ b/gcc/testsuite/gfortran.dg/auto_char_dummy_array_1.f90
@@ -54,3 +54,4 @@ contains
end program oh_no_not_pr15908_again
+! { dg-final { cleanup-modules "global" } }
diff --git a/gcc/testsuite/gfortran.dg/auto_char_len_3.f90 b/gcc/testsuite/gfortran.dg/auto_char_len_3.f90
index b94151148af..da8cf5e4e78 100644
--- a/gcc/testsuite/gfortran.dg/auto_char_len_3.f90
+++ b/gcc/testsuite/gfortran.dg/auto_char_len_3.f90
@@ -23,3 +23,5 @@ program TestStringTools
if (txt .ne. "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz") &
call abort ()
end program TestStringTools
+
+! { dg-final { cleanup-modules "chtest" } }
diff --git a/gcc/testsuite/gfortran.dg/automatic_module_variable.f90 b/gcc/testsuite/gfortran.dg/automatic_module_variable.f90
index 201dcf4e1d3..c88b355b24c 100644
--- a/gcc/testsuite/gfortran.dg/automatic_module_variable.f90
+++ b/gcc/testsuite/gfortran.dg/automatic_module_variable.f90
@@ -14,3 +14,5 @@ contains
init = x
end function init
end module sd
+
+! { dg-final { cleanup-modules "sd" } }
diff --git a/gcc/testsuite/gfortran.dg/bad_automatic_objects_1.f90 b/gcc/testsuite/gfortran.dg/bad_automatic_objects_1.f90
index 27344186194..c4c1f2cb0cc 100644
--- a/gcc/testsuite/gfortran.dg/bad_automatic_objects_1.f90
+++ b/gcc/testsuite/gfortran.dg/bad_automatic_objects_1.f90
@@ -18,3 +18,5 @@ program foobar
integer, dimension (i) :: k ! { dg-error "must have constant shape" }
character (len = i) :: c2 ! { dg-error "must have constant character length" }
end program foobar
+
+! { dg-final { cleanup-modules "foo bar" } }
diff --git a/gcc/testsuite/gfortran.dg/char_array_constructor.f90 b/gcc/testsuite/gfortran.dg/char_array_constructor.f90
index 0cb4d38bf03..5f562e9fa68 100644
--- a/gcc/testsuite/gfortran.dg/char_array_constructor.f90
+++ b/gcc/testsuite/gfortran.dg/char_array_constructor.f90
@@ -13,3 +13,4 @@ program y
if (b(2) /= 'efghij') call abort
end program y
+! { dg-final { cleanup-modules "z" } }
diff --git a/gcc/testsuite/gfortran.dg/char_array_structure_constructor.f90 b/gcc/testsuite/gfortran.dg/char_array_structure_constructor.f90
index 0b6c05c3321..9d058748855 100644
--- a/gcc/testsuite/gfortran.dg/char_array_structure_constructor.f90
+++ b/gcc/testsuite/gfortran.dg/char_array_structure_constructor.f90
@@ -26,3 +26,5 @@ contains
ENDDO
end subroutine alloc
END program char_array_structure_constructor
+
+! { dg-final { cleanup-modules "global" } }
diff --git a/gcc/testsuite/gfortran.dg/char_result_11.f90 b/gcc/testsuite/gfortran.dg/char_result_11.f90
index c37b20eb75a..75e68f1ef46 100644
--- a/gcc/testsuite/gfortran.dg/char_result_11.f90
+++ b/gcc/testsuite/gfortran.dg/char_result_11.f90
@@ -113,3 +113,5 @@ program test
print *, str
end program test
+
+! { dg-final { cleanup-modules "cutils" } }
diff --git a/gcc/testsuite/gfortran.dg/char_result_9.f90 b/gcc/testsuite/gfortran.dg/char_result_9.f90
index e32df0e01b4..062901e1bed 100644
--- a/gcc/testsuite/gfortran.dg/char_result_9.f90
+++ b/gcc/testsuite/gfortran.dg/char_result_9.f90
@@ -22,3 +22,5 @@ program huj
s = s_to_c(c)
end program huj
+
+! { dg-final { cleanup-modules "foo" } }
diff --git a/gcc/testsuite/gfortran.dg/contained_1.f90 b/gcc/testsuite/gfortran.dg/contained_1.f90
index 9b6e4395492..05216b2285a 100644
--- a/gcc/testsuite/gfortran.dg/contained_1.f90
+++ b/gcc/testsuite/gfortran.dg/contained_1.f90
@@ -31,3 +31,5 @@ program contained_1
call a
if (i .ne. 1) call abort
end program
+
+! { dg-final { cleanup-modules "contained_1_mod" } }
diff --git a/gcc/testsuite/gfortran.dg/convert_1.f90 b/gcc/testsuite/gfortran.dg/convert_1.f90
index 0723cd012f1..87d3babb677 100644
--- a/gcc/testsuite/gfortran.dg/convert_1.f90
+++ b/gcc/testsuite/gfortran.dg/convert_1.f90
@@ -14,3 +14,5 @@ USE MODULE_A
USE MODULE_B
a = 0
END
+
+! { dg-final { cleanup-modules "MODULE_A MODULE_B" } }
diff --git a/gcc/testsuite/gfortran.dg/cray_pointers_5.f90 b/gcc/testsuite/gfortran.dg/cray_pointers_5.f90
index 76bb9791b8a..21081194bcf 100644
--- a/gcc/testsuite/gfortran.dg/cray_pointers_5.f90
+++ b/gcc/testsuite/gfortran.dg/cray_pointers_5.f90
@@ -13,3 +13,5 @@ end module cray_pointers_5
ipt = loc (arr)
if (any (var .ne. (/1, 2, 3, 4, 5, 6, 7, 8, 9, 10/))) call abort
end
+
+! { dg-final { cleanup-modules "cray_pointers_5" } }
diff --git a/gcc/testsuite/gfortran.dg/data_constraints_1.f90 b/gcc/testsuite/gfortran.dg/data_constraints_1.f90
index 5f11ffdbaea..bcf23ba34ac 100644
--- a/gcc/testsuite/gfortran.dg/data_constraints_1.f90
+++ b/gcc/testsuite/gfortran.dg/data_constraints_1.f90
@@ -28,3 +28,5 @@ contains
data foobar /0/ ! { dg-error "conflicts with FUNCTION" }
end function foobar
end
+
+! { dg-final { cleanup-modules "global" } }
diff --git a/gcc/testsuite/gfortran.dg/default_initialization.f90 b/gcc/testsuite/gfortran.dg/default_initialization.f90
index 4064784247d..fe67e2f5f88 100644
--- a/gcc/testsuite/gfortran.dg/default_initialization.f90
+++ b/gcc/testsuite/gfortran.dg/default_initialization.f90
@@ -16,3 +16,5 @@ module bad
end type default_initialization
type (default_initialization) t ! { dg-error "default initialization" }
end module bad
+
+! { dg-final { cleanup-modules "bad" } }
diff --git a/gcc/testsuite/gfortran.dg/der_charlen_1.f90 b/gcc/testsuite/gfortran.dg/der_charlen_1.f90
index 9f394c73f25..4bdace228d9 100644
--- a/gcc/testsuite/gfortran.dg/der_charlen_1.f90
+++ b/gcc/testsuite/gfortran.dg/der_charlen_1.f90
@@ -22,3 +22,5 @@ CONTAINS
type(T), intent(in) :: X
end subroutine
end module another_core
+
+! { dg-final { cleanup-modules "core another_core" } }
diff --git a/gcc/testsuite/gfortran.dg/der_io_2.f90 b/gcc/testsuite/gfortran.dg/der_io_2.f90
index 08afc02fd40..09878b690e9 100644
--- a/gcc/testsuite/gfortran.dg/der_io_2.f90
+++ b/gcc/testsuite/gfortran.dg/der_io_2.f90
@@ -52,4 +52,4 @@ program prog
write (*, *) zb
end program prog
-
+! { dg-final { cleanup-modules "gfortran2" } }
diff --git a/gcc/testsuite/gfortran.dg/der_io_3.f90 b/gcc/testsuite/gfortran.dg/der_io_3.f90
index 5fdc7245422..01066cf56e4 100644
--- a/gcc/testsuite/gfortran.dg/der_io_3.f90
+++ b/gcc/testsuite/gfortran.dg/der_io_3.f90
@@ -38,3 +38,5 @@ end module m2
use m2
call test
end
+
+! { dg-final { cleanup-modules "m1 m2" } }
diff --git a/gcc/testsuite/gfortran.dg/der_pointer_1.f90 b/gcc/testsuite/gfortran.dg/der_pointer_1.f90
index bf4ffc320f6..b9f98f518b9 100644
--- a/gcc/testsuite/gfortran.dg/der_pointer_1.f90
+++ b/gcc/testsuite/gfortran.dg/der_pointer_1.f90
@@ -16,3 +16,5 @@ module test
type(x_t), pointer :: x
end module test
+
+! { dg-final { cleanup-modules "test" } }
diff --git a/gcc/testsuite/gfortran.dg/der_pointer_3.f90 b/gcc/testsuite/gfortran.dg/der_pointer_3.f90
index ed56ffc6c0c..ad9f7a7f880 100644
--- a/gcc/testsuite/gfortran.dg/der_pointer_3.f90
+++ b/gcc/testsuite/gfortran.dg/der_pointer_3.f90
@@ -16,3 +16,5 @@ end module ints
program size_test
use ints
end program size_test
+
+! { dg-final { cleanup-modules "ints" } }
diff --git a/gcc/testsuite/gfortran.dg/der_pointer_4.f90 b/gcc/testsuite/gfortran.dg/der_pointer_4.f90
index c08b8461a22..f6e5532c0ac 100644
--- a/gcc/testsuite/gfortran.dg/der_pointer_4.f90
+++ b/gcc/testsuite/gfortran.dg/der_pointer_4.f90
@@ -9,3 +9,5 @@ module crash
end type foo
type (foo), save :: bar
end module crash
+
+! { dg-final { cleanup-modules "crash" } }
diff --git a/gcc/testsuite/gfortran.dg/derived_pointer_recursion.f90 b/gcc/testsuite/gfortran.dg/derived_pointer_recursion.f90
index 5ae532530d2..4af2ceefecb 100644
--- a/gcc/testsuite/gfortran.dg/derived_pointer_recursion.f90
+++ b/gcc/testsuite/gfortran.dg/derived_pointer_recursion.f90
@@ -20,3 +20,4 @@
! copyright 1996 Loren P. Meissner -- May be distributed if this line is included.
! Linked List operations with Pointer to Pointer
+! { dg-final { cleanup-modules "llo" } }
diff --git a/gcc/testsuite/gfortran.dg/derived_recursion.f90 b/gcc/testsuite/gfortran.dg/derived_recursion.f90
index d52732ff279..d0c0ea8d467 100644
--- a/gcc/testsuite/gfortran.dg/derived_recursion.f90
+++ b/gcc/testsuite/gfortran.dg/derived_recursion.f90
@@ -22,3 +22,5 @@ end module snafu
! use snafu
! foo%v = 1
! end
+
+! { dg-final { cleanup-modules "snafu" } }
diff --git a/gcc/testsuite/gfortran.dg/dummy_functions_1.f90 b/gcc/testsuite/gfortran.dg/dummy_functions_1.f90
index dfcf644c255..8076cf911a9 100644
--- a/gcc/testsuite/gfortran.dg/dummy_functions_1.f90
+++ b/gcc/testsuite/gfortran.dg/dummy_functions_1.f90
@@ -34,3 +34,5 @@ program test
use innerfun
call foo(3,f)
end program test
+
+! { dg-final { cleanup-modules "innerfun outerfun" } }
diff --git a/gcc/testsuite/gfortran.dg/elemental_initializer_1.f90 b/gcc/testsuite/gfortran.dg/elemental_initializer_1.f90
index 7280e2582b0..0e717c947d2 100644
--- a/gcc/testsuite/gfortran.dg/elemental_initializer_1.f90
+++ b/gcc/testsuite/gfortran.dg/elemental_initializer_1.f90
@@ -31,3 +31,5 @@ contains
end function len_
end module iso_varying_string
+
+! { dg-final { cleanup-modules "iso_varying_string" } }
diff --git a/gcc/testsuite/gfortran.dg/elemental_non_intrinsic_dummy_1.f90 b/gcc/testsuite/gfortran.dg/elemental_non_intrinsic_dummy_1.f90
index c14a5d87fa5..207d76a4b7b 100644
--- a/gcc/testsuite/gfortran.dg/elemental_non_intrinsic_dummy_1.f90
+++ b/gcc/testsuite/gfortran.dg/elemental_non_intrinsic_dummy_1.f90
@@ -19,3 +19,5 @@ INTEGER FUNCTION SUB(XX)
INTEGER :: XX
SUB=XX()
END
+
+! { dg-final { cleanup-modules "TT" } }
diff --git a/gcc/testsuite/gfortran.dg/elemental_pointer_1.f90 b/gcc/testsuite/gfortran.dg/elemental_pointer_1.f90
index b5d99611c78..ae18262439b 100644
--- a/gcc/testsuite/gfortran.dg/elemental_pointer_1.f90
+++ b/gcc/testsuite/gfortran.dg/elemental_pointer_1.f90
@@ -9,3 +9,5 @@ CONTAINS
POINTER :: LL ! { dg-error " POINTER attribute conflicts with ELEMENTAL attribute" }
END FUNCTION LL
END MODULE Test
+
+! { dg-final { cleanup-modules "Test" } }
diff --git a/gcc/testsuite/gfortran.dg/elemental_subroutine_1.f90 b/gcc/testsuite/gfortran.dg/elemental_subroutine_1.f90
index 450dd059e09..85ba3f9e73e 100644
--- a/gcc/testsuite/gfortran.dg/elemental_subroutine_1.f90
+++ b/gcc/testsuite/gfortran.dg/elemental_subroutine_1.f90
@@ -55,4 +55,6 @@ contains
real, intent(out) :: b
b = -a
end subroutine foobar
-end \ No newline at end of file
+end
+
+! { dg-final { cleanup-modules "pr22146" } }
diff --git a/gcc/testsuite/gfortran.dg/elemental_subroutine_2.f90 b/gcc/testsuite/gfortran.dg/elemental_subroutine_2.f90
index 5683de89d37..e9583118693 100644
--- a/gcc/testsuite/gfortran.dg/elemental_subroutine_2.f90
+++ b/gcc/testsuite/gfortran.dg/elemental_subroutine_2.f90
@@ -61,4 +61,6 @@ program test_assign
end forall
if (any(reshape (i, (/4/)).ne.(/1,8,27,64/))) call abort ()
-end program test_assign \ No newline at end of file
+end program test_assign
+
+! { dg-final { cleanup-modules "type assign" } }
diff --git a/gcc/testsuite/gfortran.dg/entry_1.f90 b/gcc/testsuite/gfortran.dg/entry_1.f90
index dae868ec851..c9048a0442a 100644
--- a/gcc/testsuite/gfortran.dg/entry_1.f90
+++ b/gcc/testsuite/gfortran.dg/entry_1.f90
@@ -43,3 +43,5 @@ program p
call test1 ()
call test2 ()
end program
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/entry_3.f90 b/gcc/testsuite/gfortran.dg/entry_3.f90
index 36595ee31e1..b4473df31ba 100644
--- a/gcc/testsuite/gfortran.dg/entry_3.f90
+++ b/gcc/testsuite/gfortran.dg/entry_3.f90
@@ -23,3 +23,5 @@ program entry_4_prog
call bar(a)
if (any (a .ne. (/3, 4/))) call abort
end program
+
+! { dg-final { cleanup-modules "entry_4" } }
diff --git a/gcc/testsuite/gfortran.dg/enum_10.f90 b/gcc/testsuite/gfortran.dg/enum_10.f90
index dad29a1c512..f1582191792 100644
--- a/gcc/testsuite/gfortran.dg/enum_10.f90
+++ b/gcc/testsuite/gfortran.dg/enum_10.f90
@@ -59,3 +59,5 @@ call f4 (one4, 1)
call f4 (two4, 2)
call f4 (max4, huge(1_4)+0)
end
+
+! { dg-final { cleanup-modules "enum_10" } }
diff --git a/gcc/testsuite/gfortran.dg/equiv_constraint_3.f90 b/gcc/testsuite/gfortran.dg/equiv_constraint_3.f90
index 89d4fcb416c..6d7c3631335 100644
--- a/gcc/testsuite/gfortran.dg/equiv_constraint_3.f90
+++ b/gcc/testsuite/gfortran.dg/equiv_constraint_3.f90
@@ -10,4 +10,4 @@ INTEGER :: L
EQUIVALENCE(K,L) ! { dg-error "conflicts with USE ASSOCIATED attribute" }
END
-
+! { dg-final { cleanup-modules "TEST" } }
diff --git a/gcc/testsuite/gfortran.dg/func_derived_1.f90 b/gcc/testsuite/gfortran.dg/func_derived_1.f90
index 5160e5ae7f2..496d2905c39 100644
--- a/gcc/testsuite/gfortran.dg/func_derived_1.f90
+++ b/gcc/testsuite/gfortran.dg/func_derived_1.f90
@@ -36,3 +36,5 @@ function f(i,x,c,arr)
end function f
end
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/func_derived_2.f90 b/gcc/testsuite/gfortran.dg/func_derived_2.f90
index 2f3aefa7ee2..35860182a31 100644
--- a/gcc/testsuite/gfortran.dg/func_derived_2.f90
+++ b/gcc/testsuite/gfortran.dg/func_derived_2.f90
@@ -39,4 +39,4 @@ program func_derived_2
if (y%i.ne.112) call abort ()
end program func_derived_2
-
+! { dg-final { cleanup-modules "mpoint" } }
diff --git a/gcc/testsuite/gfortran.dg/func_derived_3.f90 b/gcc/testsuite/gfortran.dg/func_derived_3.f90
index a271fe98f6e..6facf218e09 100644
--- a/gcc/testsuite/gfortran.dg/func_derived_3.f90
+++ b/gcc/testsuite/gfortran.dg/func_derived_3.f90
@@ -123,3 +123,5 @@ end module func_derived_3a
if (trim (line).ne."simple = 1") call abort ()
close (10)
end program
+
+! { dg-final { cleanup-modules "func_derived_3 func_derived_3a" } }
diff --git a/gcc/testsuite/gfortran.dg/generic_1.f90 b/gcc/testsuite/gfortran.dg/generic_1.f90
index 1cbf4bb8cbc..12077dab59f 100644
--- a/gcc/testsuite/gfortran.dg/generic_1.f90
+++ b/gcc/testsuite/gfortran.dg/generic_1.f90
@@ -17,3 +17,5 @@ end module
subroutine BAZ(X)
use FOO
end subroutine
+
+! { dg-final { cleanup-modules "FOO" } }
diff --git a/gcc/testsuite/gfortran.dg/generic_2.f90 b/gcc/testsuite/gfortran.dg/generic_2.f90
index 802e966c4ba..459dd7ec817 100644
--- a/gcc/testsuite/gfortran.dg/generic_2.f90
+++ b/gcc/testsuite/gfortran.dg/generic_2.f90
@@ -18,3 +18,5 @@ end module bidon
integer,intent(in) :: nspden
end subroutine nonlinear
+
+! { dg-final { cleanup-modules "bidon" } }
diff --git a/gcc/testsuite/gfortran.dg/generic_3.f90 b/gcc/testsuite/gfortran.dg/generic_3.f90
index 3cd2e9d5d55..54926038515 100644
--- a/gcc/testsuite/gfortran.dg/generic_3.f90
+++ b/gcc/testsuite/gfortran.dg/generic_3.f90
@@ -28,3 +28,5 @@ subroutine mrqcof( x, y, sig, ndata, a, ia, ma )
call gauss( x(i), a, yan, dyda, ma )
end do
end subroutine mrqcof
+
+! { dg-final { cleanup-modules "fit_functions" } }
diff --git a/gcc/testsuite/gfortran.dg/generic_4.f90 b/gcc/testsuite/gfortran.dg/generic_4.f90
index 62bc569a21c..48c32a674b0 100644
--- a/gcc/testsuite/gfortran.dg/generic_4.f90
+++ b/gcc/testsuite/gfortran.dg/generic_4.f90
@@ -26,3 +26,5 @@ y = (/1,2,3/)
call baz(y,z)
if (any (y /= z)) call abort ()
end
+
+! { dg-final { cleanup-modules "FOO" } }
diff --git a/gcc/testsuite/gfortran.dg/global_references_1.f90 b/gcc/testsuite/gfortran.dg/global_references_1.f90
index d8728d3b08d..0e633455518 100644
--- a/gcc/testsuite/gfortran.dg/global_references_1.f90
+++ b/gcc/testsuite/gfortran.dg/global_references_1.f90
@@ -96,3 +96,5 @@ END SUBROUTINE j
entry link2 (nameg) ! { dg-error "is already being used as a SUBROUTINE" }
return
end
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/host_used_types_1.f90 b/gcc/testsuite/gfortran.dg/host_used_types_1.f90
index 89da583a406..528f6de6d49 100644
--- a/gcc/testsuite/gfortran.dg/host_used_types_1.f90
+++ b/gcc/testsuite/gfortran.dg/host_used_types_1.f90
@@ -37,4 +37,6 @@ contains
end if
end subroutine SetTimeSteps
-end module ThermoData \ No newline at end of file
+end module ThermoData
+
+! { dg-final { cleanup-modules "ModelParams ThermoData" } }
diff --git a/gcc/testsuite/gfortran.dg/implicit_1.f90 b/gcc/testsuite/gfortran.dg/implicit_1.f90
index 1ecddfa0b8d..85398ca201c 100644
--- a/gcc/testsuite/gfortran.dg/implicit_1.f90
+++ b/gcc/testsuite/gfortran.dg/implicit_1.f90
@@ -9,3 +9,4 @@ implicit none
common/rommel/aaa ! { dg-error "no IMPLICIT type" "no IMPLICIT type" }
end
+! { dg-final { cleanup-modules "AHFinder_dat" } }
diff --git a/gcc/testsuite/gfortran.dg/implicit_2.f90 b/gcc/testsuite/gfortran.dg/implicit_2.f90
index c0582d703b6..4bff1784000 100644
--- a/gcc/testsuite/gfortran.dg/implicit_2.f90
+++ b/gcc/testsuite/gfortran.dg/implicit_2.f90
@@ -46,3 +46,5 @@ subroutine bar()
v%i = 42
end subroutine
end module
+
+! { dg-final { cleanup-modules "implicit_2" } }
diff --git a/gcc/testsuite/gfortran.dg/implicit_actual.f90 b/gcc/testsuite/gfortran.dg/implicit_actual.f90
index 707df9c49d2..73d31a1bb9f 100644
--- a/gcc/testsuite/gfortran.dg/implicit_actual.f90
+++ b/gcc/testsuite/gfortran.dg/implicit_actual.f90
@@ -32,3 +32,4 @@ contains
end subroutine foo
end program snafu
+! { dg-final { cleanup-modules "global" } }
diff --git a/gcc/testsuite/gfortran.dg/initialization_1.f90 b/gcc/testsuite/gfortran.dg/initialization_1.f90
index e845472043d..b9199fe68fa 100644
--- a/gcc/testsuite/gfortran.dg/initialization_1.f90
+++ b/gcc/testsuite/gfortran.dg/initialization_1.f90
@@ -34,3 +34,5 @@ contains
end subroutine foo
end module const
+
+! { dg-final { cleanup-modules "const" } }
diff --git a/gcc/testsuite/gfortran.dg/int_1.f90 b/gcc/testsuite/gfortran.dg/int_1.f90
index 4e381220a72..81937e7b1e3 100644
--- a/gcc/testsuite/gfortran.dg/int_1.f90
+++ b/gcc/testsuite/gfortran.dg/int_1.f90
@@ -170,3 +170,5 @@ program test_int
if (i4 /= 17_ik4 .or. i8 /= 17_ik8) call abort
end program test_int
+
+! { dg-final { cleanup-modules "mykinds" } }
diff --git a/gcc/testsuite/gfortran.dg/intent_used_1.f90 b/gcc/testsuite/gfortran.dg/intent_used_1.f90
index ecc06e989ce..ec23bf58579 100644
--- a/gcc/testsuite/gfortran.dg/intent_used_1.f90
+++ b/gcc/testsuite/gfortran.dg/intent_used_1.f90
@@ -15,3 +15,5 @@ MODULE global
END SUBROUTINE foo
END INTERFACE
END MODULE global
+
+! { dg-final { cleanup-modules "global" } }
diff --git a/gcc/testsuite/gfortran.dg/interface_1.f90 b/gcc/testsuite/gfortran.dg/interface_1.f90
index e2562e10417..6a398f1d25b 100644
--- a/gcc/testsuite/gfortran.dg/interface_1.f90
+++ b/gcc/testsuite/gfortran.dg/interface_1.f90
@@ -38,3 +38,5 @@ module z
end function
end module z
+
+! { dg-final { cleanup-modules "y z" } }
diff --git a/gcc/testsuite/gfortran.dg/interface_2.f90 b/gcc/testsuite/gfortran.dg/interface_2.f90
index 6b0bf2b239b..4a813d08482 100644
--- a/gcc/testsuite/gfortran.dg/interface_2.f90
+++ b/gcc/testsuite/gfortran.dg/interface_2.f90
@@ -27,3 +27,5 @@ CONTAINS
END FUNCTION Compare_Float_Single
END MODULE Compare_Float_Numbers
+
+! { dg-final { cleanup-modules "Compare_Float_Numbers" } }
diff --git a/gcc/testsuite/gfortran.dg/internal_references_2.f90 b/gcc/testsuite/gfortran.dg/internal_references_2.f90
index bda8a6fcedb..6d4c21dc218 100644
--- a/gcc/testsuite/gfortran.dg/internal_references_2.f90
+++ b/gcc/testsuite/gfortran.dg/internal_references_2.f90
@@ -17,4 +17,6 @@ contains
subroutine sub(a) ! Would give an error on "already defined" here
real a
end subroutine sub
-end module aap \ No newline at end of file
+end module aap
+
+! { dg-final { cleanup-modules "aap" } }
diff --git a/gcc/testsuite/gfortran.dg/io_constraints_1.f90 b/gcc/testsuite/gfortran.dg/io_constraints_1.f90
index fa4c973dd34..5284f2ab145 100644
--- a/gcc/testsuite/gfortran.dg/io_constraints_1.f90
+++ b/gcc/testsuite/gfortran.dg/io_constraints_1.f90
@@ -76,3 +76,5 @@ end module global
100 continue
200 format (2i6)
END
+
+! { dg-final { cleanup-modules "fails global" } }
diff --git a/gcc/testsuite/gfortran.dg/io_constraints_2.f90 b/gcc/testsuite/gfortran.dg/io_constraints_2.f90
index 8100a4d3690..ec0bd7a967f 100644
--- a/gcc/testsuite/gfortran.dg/io_constraints_2.f90
+++ b/gcc/testsuite/gfortran.dg/io_constraints_2.f90
@@ -67,3 +67,5 @@ end module global
100 continue
200 format (2i6)
END
+
+! { dg-final { cleanup-modules "global" } }
diff --git a/gcc/testsuite/gfortran.dg/large_integer_kind_1.f90 b/gcc/testsuite/gfortran.dg/large_integer_kind_1.f90
index 9511317901c..2f272db923d 100644
--- a/gcc/testsuite/gfortran.dg/large_integer_kind_1.f90
+++ b/gcc/testsuite/gfortran.dg/large_integer_kind_1.f90
@@ -36,3 +36,5 @@ program test
x = -huge(0_8)
call testoutput (x,-huge(0_8),50,'(I50)')
end program test
+
+! { dg-final { cleanup-modules "testmod" } }
diff --git a/gcc/testsuite/gfortran.dg/large_real_kind_1.f90 b/gcc/testsuite/gfortran.dg/large_real_kind_1.f90
index 705b51eeb09..84de67271b2 100644
--- a/gcc/testsuite/gfortran.dg/large_real_kind_1.f90
+++ b/gcc/testsuite/gfortran.dg/large_real_kind_1.f90
@@ -75,3 +75,5 @@ program test
c2(1:1) = ' '
if (c1 /= c2) call abort
end program test
+
+! { dg-final { cleanup-modules "testmod" } }
diff --git a/gcc/testsuite/gfortran.dg/module_blank_common.f90 b/gcc/testsuite/gfortran.dg/module_blank_common.f90
index 23bb48ab009..a06ff0098e0 100644
--- a/gcc/testsuite/gfortran.dg/module_blank_common.f90
+++ b/gcc/testsuite/gfortran.dg/module_blank_common.f90
@@ -16,4 +16,4 @@ program blank_common
if (z.ne.cmplx (a,b)) call abort ()
end program blank_common
-
+! { dg-final { cleanup-modules "global" } }
diff --git a/gcc/testsuite/gfortran.dg/module_commons_1.f90 b/gcc/testsuite/gfortran.dg/module_commons_1.f90
index 996074c0778..bd2c7f99be1 100644
--- a/gcc/testsuite/gfortran.dg/module_commons_1.f90
+++ b/gcc/testsuite/gfortran.dg/module_commons_1.f90
@@ -22,3 +22,4 @@ program collision
call foo ()
end program collision
+! { dg-final { cleanup-modules "m1 m2" } }
diff --git a/gcc/testsuite/gfortran.dg/module_double_reuse.f90 b/gcc/testsuite/gfortran.dg/module_double_reuse.f90
index 8c1b6ec6367..694e821b786 100644
--- a/gcc/testsuite/gfortran.dg/module_double_reuse.f90
+++ b/gcc/testsuite/gfortran.dg/module_double_reuse.f90
@@ -17,3 +17,4 @@ program d
if (v.ne.u) call abort ()
end program d
+! { dg-final { cleanup-modules "a" } }
diff --git a/gcc/testsuite/gfortran.dg/module_equivalence_1.f90 b/gcc/testsuite/gfortran.dg/module_equivalence_1.f90
index d8268ca722f..fecfb89fac3 100644
--- a/gcc/testsuite/gfortran.dg/module_equivalence_1.f90
+++ b/gcc/testsuite/gfortran.dg/module_equivalence_1.f90
@@ -23,4 +23,4 @@ program module_equiv
call foo ()
end program module_equiv
-
+! { dg-final { cleanup-modules "test_equiv" } }
diff --git a/gcc/testsuite/gfortran.dg/module_interface_1.f90 b/gcc/testsuite/gfortran.dg/module_interface_1.f90
index 7301f48ff32..15139c04f1a 100644
--- a/gcc/testsuite/gfortran.dg/module_interface_1.f90
+++ b/gcc/testsuite/gfortran.dg/module_interface_1.f90
@@ -33,4 +33,6 @@
if (N(1).ne.5) call abort ()
return
end subroutine Selection_Sort
- end program module_interface \ No newline at end of file
+ end program module_interface
+
+! { dg-final { cleanup-modules "Max_Loc_mod" } }
diff --git a/gcc/testsuite/gfortran.dg/module_parameter_array_refs_1.f90 b/gcc/testsuite/gfortran.dg/module_parameter_array_refs_1.f90
index a78b5253958..592e2f3dd2a 100644
--- a/gcc/testsuite/gfortran.dg/module_parameter_array_refs_1.f90
+++ b/gcc/testsuite/gfortran.dg/module_parameter_array_refs_1.f90
@@ -11,3 +11,4 @@ module foo
end
+! { dg-final { cleanup-modules "foo" } }
diff --git a/gcc/testsuite/gfortran.dg/named_interface.f90 b/gcc/testsuite/gfortran.dg/named_interface.f90
index 90fea809fb0..29cfae88275 100644
--- a/gcc/testsuite/gfortran.dg/named_interface.f90
+++ b/gcc/testsuite/gfortran.dg/named_interface.f90
@@ -7,3 +7,5 @@ module snafu
end subroutine really_snafu
end interface foo
end module snafu
+
+! { dg-final { cleanup-modules "snafu" } }
diff --git a/gcc/testsuite/gfortran.dg/namelist_1.f90 b/gcc/testsuite/gfortran.dg/namelist_1.f90
index ee028dd0e5e..e4154e9181b 100644
--- a/gcc/testsuite/gfortran.dg/namelist_1.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_1.f90
@@ -5,3 +5,5 @@ module namelist_1
integer,private :: x
namelist /n/ x ! { dg-error "cannot be member of PUBLIC namelist" "" }
end module
+
+! { dg-final { cleanup-modules "namelist_1" } }
diff --git a/gcc/testsuite/gfortran.dg/namelist_14.f90 b/gcc/testsuite/gfortran.dg/namelist_14.f90
index b8d7e9bc6e7..e95495aaf2c 100644
--- a/gcc/testsuite/gfortran.dg/namelist_14.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_14.f90
@@ -92,3 +92,5 @@ contains
end subroutine foo
end program namelist_14
+
+! { dg-final { cleanup-modules "global" } }
diff --git a/gcc/testsuite/gfortran.dg/namelist_15.f90 b/gcc/testsuite/gfortran.dg/namelist_15.f90
index a6d449b4879..7bfe9310979 100644
--- a/gcc/testsuite/gfortran.dg/namelist_15.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_15.f90
@@ -57,3 +57,5 @@ program namelist_15
(x(2)%m(2)%ch(2) == "kz"))) call abort ()
end program namelist_15
+
+! { dg-final { cleanup-modules "global" } }
diff --git a/gcc/testsuite/gfortran.dg/namelist_4.f90 b/gcc/testsuite/gfortran.dg/namelist_4.f90
index 0e1b0eef51f..9e62a1f370f 100644
--- a/gcc/testsuite/gfortran.dg/namelist_4.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_4.f90
@@ -37,3 +37,4 @@ CONTAINS
END FUNCTION
END
+! { dg-final { cleanup-modules "M1" } }
diff --git a/gcc/testsuite/gfortran.dg/namelist_use.f90 b/gcc/testsuite/gfortran.dg/namelist_use.f90
index 6d5cf8065f7..0460630dd33 100644
--- a/gcc/testsuite/gfortran.dg/namelist_use.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_use.f90
@@ -29,3 +29,5 @@ program namelist_use
close (10)
end program namelist_use
+
+! { dg-final { cleanup-modules "global" } }
diff --git a/gcc/testsuite/gfortran.dg/namelist_use_only.f90 b/gcc/testsuite/gfortran.dg/namelist_use_only.f90
index 3f7b8e6ff4e..a9adf015ded 100644
--- a/gcc/testsuite/gfortran.dg/namelist_use_only.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_use_only.f90
@@ -32,3 +32,5 @@ program namelist_use_only
if ((i.ne.0).or.(rrrr.ne.3.5).or.foo()) call abort ()
close (10)
end program namelist_use_only
+
+! { dg-final { cleanup-modules "global" } }
diff --git a/gcc/testsuite/gfortran.dg/nested_modules_1.f90 b/gcc/testsuite/gfortran.dg/nested_modules_1.f90
index 77960121788..85a2483cf74 100644
--- a/gcc/testsuite/gfortran.dg/nested_modules_1.f90
+++ b/gcc/testsuite/gfortran.dg/nested_modules_1.f90
@@ -41,3 +41,5 @@
call eyeore ()
call tigger (w)
end
+
+! { dg-final { cleanup-modules "mod0 mod1 mod2" } }
diff --git a/gcc/testsuite/gfortran.dg/nested_modules_2.f90 b/gcc/testsuite/gfortran.dg/nested_modules_2.f90
index 91ab766c1be..3d0985a7eac 100644
--- a/gcc/testsuite/gfortran.dg/nested_modules_2.f90
+++ b/gcc/testsuite/gfortran.dg/nested_modules_2.f90
@@ -36,3 +36,4 @@ program testfoobar
if (all (l.ne.(/84,42,0/))) call abort ()
end program testfoobar
+! { dg-final { cleanup-modules "foo bar foobar" } }
diff --git a/gcc/testsuite/gfortran.dg/nested_modules_3.f90 b/gcc/testsuite/gfortran.dg/nested_modules_3.f90
index 364460c6138..7550368bcd9 100644
--- a/gcc/testsuite/gfortran.dg/nested_modules_3.f90
+++ b/gcc/testsuite/gfortran.dg/nested_modules_3.f90
@@ -53,3 +53,5 @@ PROGRAM use_foobar
CALL sub3 (z, j)
IF (ALL (j.ne.(/3,2,1/))) CALL abort ()
END PROGRAM use_foobar
+
+! { dg-final { cleanup-modules "foo bar foobar" } }
diff --git a/gcc/testsuite/gfortran.dg/nested_modules_4.f90 b/gcc/testsuite/gfortran.dg/nested_modules_4.f90
index b9e0fd39467..dde171c7ed9 100644
--- a/gcc/testsuite/gfortran.dg/nested_modules_4.f90
+++ b/gcc/testsuite/gfortran.dg/nested_modules_4.f90
@@ -23,3 +23,5 @@ end module serial
character*15 :: buffer
buffer = lc ("Have a Nice DAY")
end
+
+! { dg-final { cleanup-modules "string serial" } }
diff --git a/gcc/testsuite/gfortran.dg/nested_modules_5.f90 b/gcc/testsuite/gfortran.dg/nested_modules_5.f90
index 7f96bdba0d4..86b43fd7b36 100644
--- a/gcc/testsuite/gfortran.dg/nested_modules_5.f90
+++ b/gcc/testsuite/gfortran.dg/nested_modules_5.f90
@@ -24,3 +24,5 @@ end module serial
character*15 :: buffer
buffer = lc ("Have a Nice DAY")
end
+
+! { dg-final { cleanup-modules "anything serial" } }
diff --git a/gcc/testsuite/gfortran.dg/parens_5.f90 b/gcc/testsuite/gfortran.dg/parens_5.f90
index 36bba8a0849..a6e64b4112a 100644
--- a/gcc/testsuite/gfortran.dg/parens_5.f90
+++ b/gcc/testsuite/gfortran.dg/parens_5.f90
@@ -17,3 +17,5 @@ program test
c = bobo(5)
if (c .ne. "12345") call abort
end program test
+
+! { dg-final { cleanup-modules "para" } }
diff --git a/gcc/testsuite/gfortran.dg/parent_result_ref_4.f90 b/gcc/testsuite/gfortran.dg/parent_result_ref_4.f90
index d8c84e7cd6b..174d6456934 100644
--- a/gcc/testsuite/gfortran.dg/parent_result_ref_4.f90
+++ b/gcc/testsuite/gfortran.dg/parent_result_ref_4.f90
@@ -20,3 +20,5 @@ end module m
use m
if (f ().ne.2) call abort ()
end
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/pr15164.f90 b/gcc/testsuite/gfortran.dg/pr15164.f90
index f4fef7069f7..f8098710bee 100644
--- a/gcc/testsuite/gfortran.dg/pr15164.f90
+++ b/gcc/testsuite/gfortran.dg/pr15164.f90
@@ -14,3 +14,4 @@
end subroutine split
end module specfiles
+! { dg-final { cleanup-modules "specfiles" } }
diff --git a/gcc/testsuite/gfortran.dg/pr16861.f90 b/gcc/testsuite/gfortran.dg/pr16861.f90
index 4a73edaf4f0..88f89fa78b5 100644
--- a/gcc/testsuite/gfortran.dg/pr16861.f90
+++ b/gcc/testsuite/gfortran.dg/pr16861.f90
@@ -30,3 +30,5 @@ end subroutine quus
program test
call quus
end program test
+
+! { dg-final { cleanup-modules "foo bar" } }
diff --git a/gcc/testsuite/gfortran.dg/pr17615.f90 b/gcc/testsuite/gfortran.dg/pr17615.f90
index 13b90334a7b..76676182f4c 100644
--- a/gcc/testsuite/gfortran.dg/pr17615.f90
+++ b/gcc/testsuite/gfortran.dg/pr17615.f90
@@ -17,3 +17,5 @@ PROGRAM TEST
real(8) :: c(3)
c = cross_product()
END PROGRAM TEST
+
+! { dg-final { cleanup-modules "module_vec3d" } }
diff --git a/gcc/testsuite/gfortran.dg/pr19926.f90 b/gcc/testsuite/gfortran.dg/pr19926.f90
index 34991ec2ec6..ae70d5b0fa8 100644
--- a/gcc/testsuite/gfortran.dg/pr19926.f90
+++ b/gcc/testsuite/gfortran.dg/pr19926.f90
@@ -23,3 +23,4 @@ subroutine string_comp(i)
i = map(42)
end subroutine string_comp
+! { dg-final { cleanup-modules "b" } }
diff --git a/gcc/testsuite/gfortran.dg/pr21177.f90 b/gcc/testsuite/gfortran.dg/pr21177.f90
index 8ce0180dfc1..48d35312318 100644
--- a/gcc/testsuite/gfortran.dg/pr21177.f90
+++ b/gcc/testsuite/gfortran.dg/pr21177.f90
@@ -51,3 +51,5 @@ program test
if (tt(null(c4)) /= 3) call abort()
if (tt(null(c8)) /= 4) call abort()
end program test
+
+! { dg-final { cleanup-modules "mymod" } }
diff --git a/gcc/testsuite/gfortran.dg/pr26246_1.f90 b/gcc/testsuite/gfortran.dg/pr26246_1.f90
index a1cb45535fe..e35bcaca309 100644
--- a/gcc/testsuite/gfortran.dg/pr26246_1.f90
+++ b/gcc/testsuite/gfortran.dg/pr26246_1.f90
@@ -16,3 +16,4 @@ end module pr26246_1
! { dg-final { scan-tree-dump-times "static int" 0 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
+! { dg-final { cleanup-modules "pr26246_1" } }
diff --git a/gcc/testsuite/gfortran.dg/private_type_1.f90 b/gcc/testsuite/gfortran.dg/private_type_1.f90
index e36e20a5e5a..34bc457a52f 100644
--- a/gcc/testsuite/gfortran.dg/private_type_1.f90
+++ b/gcc/testsuite/gfortran.dg/private_type_1.f90
@@ -17,3 +17,4 @@ contains
end subroutine dummysub
end module modboom
+! { dg-final { cleanup-modules "modboom" } }
diff --git a/gcc/testsuite/gfortran.dg/private_type_2.f90 b/gcc/testsuite/gfortran.dg/private_type_2.f90
index 9cb0b380703..690be5d3a85 100644
--- a/gcc/testsuite/gfortran.dg/private_type_2.f90
+++ b/gcc/testsuite/gfortran.dg/private_type_2.f90
@@ -21,4 +21,4 @@ MODULE TEST
END MODULE
END
-
+! { dg-final { cleanup-modules "TEST" } }
diff --git a/gcc/testsuite/gfortran.dg/private_type_3.f90 b/gcc/testsuite/gfortran.dg/private_type_3.f90
index b8fad6626ed..dea35818ea3 100644
--- a/gcc/testsuite/gfortran.dg/private_type_3.f90
+++ b/gcc/testsuite/gfortran.dg/private_type_3.f90
@@ -31,3 +31,4 @@ module c
end subroutine d
end module c
+! { dg-final { cleanup-modules "a c" } }
diff --git a/gcc/testsuite/gfortran.dg/private_type_4.f90 b/gcc/testsuite/gfortran.dg/private_type_4.f90
index a5b5578c45a..aca8795fc0c 100644
--- a/gcc/testsuite/gfortran.dg/private_type_4.f90
+++ b/gcc/testsuite/gfortran.dg/private_type_4.f90
@@ -15,3 +15,5 @@ contains
end function
end module
+
+! { dg-final { cleanup-modules "m1" } }
diff --git a/gcc/testsuite/gfortran.dg/procedure_lvalue.f90 b/gcc/testsuite/gfortran.dg/procedure_lvalue.f90
index 575c2ca91a5..2a2c3550454 100644
--- a/gcc/testsuite/gfortran.dg/procedure_lvalue.f90
+++ b/gcc/testsuite/gfortran.dg/procedure_lvalue.f90
@@ -16,4 +16,6 @@ subroutine r
use t
b = 1. ! { dg-error "l-value since it is a procedure" }
y = a(1.)
-end subroutine r \ No newline at end of file
+end subroutine r
+
+! { dg-final { cleanup-modules "t" } }
diff --git a/gcc/testsuite/gfortran.dg/pure_byref_3.f90 b/gcc/testsuite/gfortran.dg/pure_byref_3.f90
index cb2644ff898..a9d860bf041 100644
--- a/gcc/testsuite/gfortran.dg/pure_byref_3.f90
+++ b/gcc/testsuite/gfortran.dg/pure_byref_3.f90
@@ -31,3 +31,5 @@ program pure_byref_3
a = hoj()
if (.not. all(a == (/1, 2, 3/))) call abort()
end program pure_byref_3
+
+! { dg-final { cleanup-modules "huj_mod" } }
diff --git a/gcc/testsuite/gfortran.dg/same_name_1.f90 b/gcc/testsuite/gfortran.dg/same_name_1.f90
index cbeb875e36b..5cf13a93bed 100644
--- a/gcc/testsuite/gfortran.dg/same_name_1.f90
+++ b/gcc/testsuite/gfortran.dg/same_name_1.f90
@@ -11,3 +11,5 @@ contains
subroutine u
end subroutine u
end module m
+
+! { dg-final { cleanup-modules "n m" } }
diff --git a/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_1.f90 b/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_1.f90
index 2c7acbe1ba5..c632c5b1b15 100644
--- a/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_1.f90
+++ b/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_1.f90
@@ -30,3 +30,5 @@ contains
call bar(self, z)
end subroutine
end
+
+! { dg-final { cleanup-modules "foo" } }
diff --git a/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_2.f90 b/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_2.f90
index 042666016f7..3bd3164995b 100644
--- a/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_2.f90
+++ b/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_2.f90
@@ -30,3 +30,5 @@ contains
call bar_(self, z)
end subroutine
end
+
+! { dg-final { cleanup-modules "foo" } }
diff --git a/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_3.f90 b/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_3.f90
index 5f1391edb60..21bdceead95 100644
--- a/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_3.f90
+++ b/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_3.f90
@@ -16,3 +16,5 @@ module ice
end subroutine bar
end subroutine foo
end module
+
+! { dg-final { cleanup-modules "ice" } }
diff --git a/gcc/testsuite/gfortran.dg/substr_1.f90 b/gcc/testsuite/gfortran.dg/substr_1.f90
index 15ab390f906..a811d9688cc 100644
--- a/gcc/testsuite/gfortran.dg/substr_1.f90
+++ b/gcc/testsuite/gfortran.dg/substr_1.f90
@@ -11,3 +11,4 @@ character(4) :: b
b = a
end
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/substring_equivalence.f90 b/gcc/testsuite/gfortran.dg/substring_equivalence.f90
index 1a01024bc11..9a94bcddf72 100644
--- a/gcc/testsuite/gfortran.dg/substring_equivalence.f90
+++ b/gcc/testsuite/gfortran.dg/substring_equivalence.f90
@@ -6,3 +6,5 @@ module FLAGS
character :: at, dev
equivalence ( encodings(1:1),at ), ( encodings(2:2),dev)
end module FLAGS
+
+! { dg-final { cleanup-modules "FLAGS" } }
diff --git a/gcc/testsuite/gfortran.dg/use_allocated_1.f90 b/gcc/testsuite/gfortran.dg/use_allocated_1.f90
index fb51502edc2..e590f6a9561 100644
--- a/gcc/testsuite/gfortran.dg/use_allocated_1.f90
+++ b/gcc/testsuite/gfortran.dg/use_allocated_1.f90
@@ -16,3 +16,5 @@ subroutine init
use foo
if (.not.allocated(bar)) call abort
end subroutine init
+
+! { dg-final { cleanup-modules "foo" } }
diff --git a/gcc/testsuite/gfortran.dg/used_dummy_types_1.f90 b/gcc/testsuite/gfortran.dg/used_dummy_types_1.f90
index 9d034a680da..0cf01bb50e2 100644
--- a/gcc/testsuite/gfortran.dg/used_dummy_types_1.f90
+++ b/gcc/testsuite/gfortran.dg/used_dummy_types_1.f90
@@ -33,4 +33,6 @@ end module atest
call init ()
call test (res)
if (res%a.ne.42) call abort
-end \ No newline at end of file
+end
+
+! { dg-final { cleanup-modules "mtyp atest" } }
diff --git a/gcc/testsuite/gfortran.dg/used_dummy_types_2.f90 b/gcc/testsuite/gfortran.dg/used_dummy_types_2.f90
index f12d2864d0b..a47cabc430c 100644
--- a/gcc/testsuite/gfortran.dg/used_dummy_types_2.f90
+++ b/gcc/testsuite/gfortran.dg/used_dummy_types_2.f90
@@ -30,3 +30,5 @@ contains
v = x%f2(:)
end subroutine foo
end module mod2
+
+! { dg-final { cleanup-modules "mod1 mod2" } }
diff --git a/gcc/testsuite/gfortran.dg/used_dummy_types_3.f90 b/gcc/testsuite/gfortran.dg/used_dummy_types_3.f90
index b252e45471f..5bc4523dd8d 100644
--- a/gcc/testsuite/gfortran.dg/used_dummy_types_3.f90
+++ b/gcc/testsuite/gfortran.dg/used_dummy_types_3.f90
@@ -34,3 +34,4 @@
CALL TEST(x) ! { dg-error "Type/rank mismatch in argument" }
END
+! { dg-final { cleanup-modules "T1 T2" } }
diff --git a/gcc/testsuite/gfortran.dg/used_dummy_types_4.f90 b/gcc/testsuite/gfortran.dg/used_dummy_types_4.f90
index 98b5905d478..4bc7c386895 100644
--- a/gcc/testsuite/gfortran.dg/used_dummy_types_4.f90
+++ b/gcc/testsuite/gfortran.dg/used_dummy_types_4.f90
@@ -99,3 +99,4 @@ contains
end subroutine foo
END
+! { dg-final { cleanup-modules "global" } }
diff --git a/gcc/testsuite/gfortran.dg/used_dummy_types_5.f90 b/gcc/testsuite/gfortran.dg/used_dummy_types_5.f90
index b8b15e00950..2000c3271fc 100644
--- a/gcc/testsuite/gfortran.dg/used_dummy_types_5.f90
+++ b/gcc/testsuite/gfortran.dg/used_dummy_types_5.f90
@@ -83,3 +83,4 @@ contains
end subroutine foo
END
+! { dg-final { cleanup-modules "global" } }
diff --git a/gcc/testsuite/gfortran.dg/used_interface_ref.f90 b/gcc/testsuite/gfortran.dg/used_interface_ref.f90
index d4a9c96edac..3e0290c9714 100644
--- a/gcc/testsuite/gfortran.dg/used_interface_ref.f90
+++ b/gcc/testsuite/gfortran.dg/used_interface_ref.f90
@@ -43,6 +43,5 @@
REAL :: solveCConvert(1:anzKomponenten)
solveCConvert = (/(real(i), i = 1, anzKomponenten)/)
END FUNCTION solveCConvert
-
-
+! { dg-final { cleanup-modules "MODULE_CONC MODULE_THERMOCALC" } }
diff --git a/gcc/testsuite/gfortran.dg/used_types_1.f90 b/gcc/testsuite/gfortran.dg/used_types_1.f90
index 61356ab2c56..4fbd328910e 100644
--- a/gcc/testsuite/gfortran.dg/used_types_1.f90
+++ b/gcc/testsuite/gfortran.dg/used_types_1.f90
@@ -19,3 +19,5 @@ CONTAINS
mtpcar%coo='a' !ICE was here
END SUBROUTINE str_clan
END MODULE
+
+! { dg-final { cleanup-modules "testcase tp_trace" } }
diff --git a/gcc/testsuite/gfortran.dg/userdef_operator_1.f90 b/gcc/testsuite/gfortran.dg/userdef_operator_1.f90
index 5bf99d04acd..e8af3720afd 100644
--- a/gcc/testsuite/gfortran.dg/userdef_operator_1.f90
+++ b/gcc/testsuite/gfortran.dg/userdef_operator_1.f90
@@ -33,3 +33,4 @@ program opshape
end program opshape
+! { dg-final { cleanup-modules "geometry" } }
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 2b668eb8e3a..e0640d8a0fc 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -404,6 +404,13 @@ proc cleanup-saved-temps { } {
}
}
+# Remove files for specified Fortran modules.
+proc cleanup-modules { modlist } {
+ foreach modname $modlist {
+ remove-build-file [string tolower $modname].mod
+ }
+}
+
# We need to make sure that additional_* are cleared out after every
# test. It is not enough to clear them out *before* the next test run
# because gcc-target-compile gets run directly from some .exp files