Patchwork [Fortran,testsuite,committed] Add/fix dg-final cleanup-module

login
register
mail settings
Submitter Tobias Burnus
Date Aug. 2, 2011, 3:34 p.m.
Message ID <4E381916.6030100@net-b.de>
Download mbox | patch
Permalink /patch/107949/
State New
Headers show

Comments

Tobias Burnus - Aug. 2, 2011, 3:34 p.m.
This patch fixes dg-final cleanup-modules issues:
* Missing cleanups
* Wrong case: All module files are lower case
* Wrong cleanup (clean up .mod which don't exist instead of the one 
which exists)

One test case actually failed because it had a spurious "use foo" in it 
- I have now deleted that line instead of creating a dummy module ...

There might be still some missing or wrong cleanups, but most remaining 
.mod files are from gfortran.fortran-torture.

Regtested on x86-64-linux and committed as Rev. 177184.

Tobias
Mikael Morin - Aug. 2, 2011, 4:01 p.m.
It's a pity that I've made the same fixes myself. I was planing to commit 
soon. :-(

On Tuesday 02 August 2011 17:34:46 Tobias Burnus wrote:
> This patch fixes dg-final cleanup-modules issues:
> * Missing cleanups
> * Wrong case: All module files are lower case
This is not actually a problem as cleanup-module is:

# Remove files for specified Fortran modules.
proc cleanup-modules { modlist } {
    foreach modname $modlist {
	remove-build-file [string tolower $modname].mod
    }
}

(note the "string tolower")


> * Wrong cleanup (clean up .mod which don't exist instead of the one
> which exists)
> 
> One test case actually failed because it had a spurious "use foo" in it
> - I have now deleted that line instead of creating a dummy module ...
> 
> There might be still some missing or wrong cleanups, but most remaining
> .mod files are from gfortran.fortran-torture.
> 
> Regtested on x86-64-linux and committed as Rev. 177184.

Thanks. I'll see if I have additional fixes after updating.

Mikael
Tobias Burnus - Aug. 2, 2011, 4:13 p.m.
On 08/02/2011 06:01 PM, Mikael Morin wrote:
> It's a pity that I've made the same fixes myself. I was planing to commit
> soon. :-(

Indeed it would have been more useful to avoid replicating the work. :-(

> On Tuesday 02 August 2011 17:34:46 Tobias Burnus wrote:
>> * Wrong case: All module files are lower case
> This is not actually a problem as cleanup-module is:
> 	remove-build-file [string tolower $modname].mod
> (note the "string tolower")

Missed that. There were by chance that many .mod files where the case 
didn't fit that I thought that the case had to be the lower case.

> Thanks. I'll see if I have additional fixes after updating.

OK. It also helps to check for '{ dg-do "run" }' (spurious quotation) or 
for "{dg-do run }" (missing space after "{"). I grepped a bit but I 
might have missed also some of those.

Tobias

Patch

2011-08-02  Tobias Burnus  <burnus@net-b.de>

	* trim_optimize_5.f90: Remove spurious "use foo".
	* actual_array_vect_1.f90: Fix or add dg-final cleanup-module
	* alloc_comp_assign_7.f90: Ditto.
	* allocatable_function_5.f90: Ditto.
	* allocate_stat.f90: Ditto.
	* array_constructor_20.f90: Ditto.
	* array_constructor_21.f90: Ditto.
	* array_constructor_22.f90: Ditto.
	* array_constructor_26.f03: Ditto.
	* array_function_4.f90: Ditto.
	* assumed_charlen_function_1.f90: Ditto.
	* assumed_size_dt_dummy.f90: Ditto.
	* bind_c_usage_15.f90: Ditto.
	* bind_c_usage_16.f03: Ditto.
	* bind_c_usage_3.f03: Ditto.
	* binding_label_tests_7.f03: Ditto.
	* class_15.f03: Ditto.
	* class_27.f03: Ditto.
	* class_33.f90: Ditto.
	* class_37.f03: Ditto.
	* class_40.f03: Ditto.
	* class_42.f03: Ditto.
	* class_defined_operator_1.f03: Ditto.
	* coarray/registering_1.f90: Ditto.
	* convert_1.f90: Ditto.
	* default_initialization_3.f90: Ditto.
	* dependency_25.f90: Ditto.
	* dependency_26.f90: Ditto.
	* dependency_36.f90: Ditto.
	* dependency_37.f90: Ditto.
	* derived_array_intrinisics_1.f90: Ditto.
	* dynamic_dispatch_10.f03: Ditto.
	* elemental_non_intrinsic_dummy_1.f90 |: Ditto.
	* elemental_pointer_1.f90: Ditto.
	* elemental_result_1.f90: Ditto.
	* empty_derived_type.f90: Ditto.
	* entry_7.f90: Ditto.
	* entry_dummy_ref_2.f90: Ditto.
	* equiv_constraint_3.f90: Ditto.
	* error_recovery_3.f90: Ditto.
	* extends_4.f03: Ditto.
	* func_assign.f90: Ditto.
	* func_assign_3.f90: Ditto.
	* generic_1.f90: Ditto.
	* generic_18.f90: Ditto.
	* generic_22.f03: Ditto.
	* generic_4.f90: Ditto.
	* generic_6.f90: Ditto.
	* generic_actual_arg.f90: Ditto.
	* graphite/id-21.f: Ditto.
	* graphite/pr45758.f90: Ditto.
	* host_assoc_call_2.f90: Ditto.
	* host_assoc_call_3.f90: Ditto.
	* host_assoc_call_4.f90: Ditto.
	* host_assoc_function_4.f90: Ditto.
	* host_used_types_1.f90: Ditto.
	* implicit_1.f90: Ditto.
	* implicit_11.f90: Ditto.
	* implicit_derived_type_1.f90: Ditto.
	* impure_actual_1.f90: Ditto.
	* impure_assignment_1.f90: Ditto.
	* impure_constructor_1.f90: Ditto.
	* initialization_10.f90: Ditto.
	* initialization_12.f90: Ditto.
	* interface_14.f90: Ditto.
	* interface_15.f90: Ditto.
	* interface_2.f90: Ditto.
	* interface_25.f90: Ditto.
	* interface_26.f90: Ditto.
	* interface_29.f90: Ditto.
	* interface_assignment_1.f90: Ditto.
	* internal_pack_6.f90: Ditto.
	* internal_pack_7.f90: Ditto.
	* internal_pack_8.f90: Ditto.
	* lto/pr45586_0.f90: Ditto.
	* lto/pr47839_0.f90: Ditto.
	* module_commons_3.f90: Ditto.
	* module_equivalence_4.f90: Ditto.
	* module_equivalence_6.f90: Ditto.
	* module_function_type_1.f90: Ditto.
	* module_naming_1.f90: Ditto.
	* namelist_4.f90: Ditto.
	* operator_c1202.f90: Ditto.
	* parens_7.f90: Ditto.
	* pr32921.f: Ditto.
	* pr33646.f90: Ditto.
	* pr41928.f90: Ditto.
	* pr42119.f90: Ditto.
	* pr43984.f90: Ditto.
	* present_1.f90: Ditto.
	* private_type_2.f90: Ditto.
	* proc_decl_2.f90: Ditto.
	* proc_ptr_10.f90: Ditto.
	* proc_ptr_22.f90: Ditto.
	* proc_ptr_8.f90: Ditto.
	* proc_ptr_comp_12.f90: Ditto.
	* proc_ptr_comp_pass_6.f90: Ditto.
	* pure_formal_proc_2.f90: Ditto.
	* realloc_on_assign_4.f03: Ditto.
	* substring_equivalence.f90: Ditto.
	* transfer_assumed_size_1.f90: Ditto.
	* transpose_optimization_1.f90: Ditto.
	* trim_optimize_6.f90: Ditto.
	* typebound_call_12.f03: Ditto.
	* typebound_operator_5.f03: Ditto.
	* typebound_operator_6.f03: Ditto.
	* typebound_proc_18.f03: Ditto.
	* unreferenced_use_assoc_1.f90: Ditto.
	* use_1.f90: Ditto.
	* use_10.f90: Ditto.
	* use_11.f90: Ditto.
	* use_14.f90: Ditto.
	* use_only_2.f90: Ditto.
	* use_rename_4.f90: Ditto.
	* use_rename_5.f90: Ditto.
	* used_dummy_types_3.f90: Ditto.
	* used_interface_ref.f90: Ditto.
	* used_types_11.f90: Ditto.
	* used_types_3.f90: Ditto.
	* used_types_4.f90: Ditto.
	* userdef_operator_2.f90: Ditto.
	* vect/fast-math-vect-8.f90: Ditto.
	* vect/pr46213.f90: Ditto.
	* whole_file_21.f90: Ditto.
	* whole_file_22.f90: Ditto.
	* coarray_lib_token_1.f90: Ditto. Add space before "}".
	* coarray_lib_token_2.f90: Ditto.

diff --git a/gcc/testsuite/gfortran.dg/actual_array_vect_1.f90 b/gcc/testsuite/gfortran.dg/actual_array_vect_1.f90
index 8b4d6f4..cbee226 100644
--- a/gcc/testsuite/gfortran.dg/actual_array_vect_1.f90
+++ b/gcc/testsuite/gfortran.dg/actual_array_vect_1.f90
@@ -31,3 +31,5 @@  call bb(w(2:4))
 call bb(w((/3,2,1/))) ! { dg-error "vector subscript" }
 write(*,*)w
 end
+
+! { dg-final { cleanup-modules "mod" } }
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_assign_7.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_assign_7.f90
index c0f3c76..c7e9b75 100644
--- a/gcc/testsuite/gfortran.dg/alloc_comp_assign_7.f90
+++ b/gcc/testsuite/gfortran.dg/alloc_comp_assign_7.f90
@@ -37,4 +37,4 @@  end module PrettyPix_module
   end do
 end
 
-! { dg-final { cleanup-modules "PrettyPix_module" } }
+! { dg-final { cleanup-modules "prettypix_module" } }
diff --git a/gcc/testsuite/gfortran.dg/allocatable_function_5.f90 b/gcc/testsuite/gfortran.dg/allocatable_function_5.f90
index 8e7d49b..087100c 100644
--- a/gcc/testsuite/gfortran.dg/allocatable_function_5.f90
+++ b/gcc/testsuite/gfortran.dg/allocatable_function_5.f90
@@ -46,3 +46,5 @@  contains
     bar = carg(1:12)
   end function
 end
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/allocate_stat.f90 b/gcc/testsuite/gfortran.dg/allocate_stat.f90
index 7f9eaf5..ceddc92 100644
--- a/gcc/testsuite/gfortran.dg/allocate_stat.f90
+++ b/gcc/testsuite/gfortran.dg/allocate_stat.f90
@@ -74,3 +74,4 @@  contains
    if(associated(p)) deallocate(p)
  end subroutine sub
 end module test
+! { dg-final { cleanup-modules "test" } }
diff --git a/gcc/testsuite/gfortran.dg/array_constructor_20.f90 b/gcc/testsuite/gfortran.dg/array_constructor_20.f90
index de7246d..2908edb 100644
--- a/gcc/testsuite/gfortran.dg/array_constructor_20.f90
+++ b/gcc/testsuite/gfortran.dg/array_constructor_20.f90
@@ -19,4 +19,4 @@  CONTAINS
   end subroutine
 END MODULE s_TESTS
 
-! { dg-final { cleanup-modules "m s_TESTS" } }
+! { dg-final { cleanup-modules "m s_tests" } }
diff --git a/gcc/testsuite/gfortran.dg/array_constructor_21.f90 b/gcc/testsuite/gfortran.dg/array_constructor_21.f90
index f9e612c..e24b146 100644
--- a/gcc/testsuite/gfortran.dg/array_constructor_21.f90
+++ b/gcc/testsuite/gfortran.dg/array_constructor_21.f90
@@ -33,4 +33,4 @@ 
           UDS0L = SEQ(RESHAPE ( (/ ((CA_T(J1,J2), J1 = 1, 1), J2 = 1, 2)/),(/2/)))
         END SUBROUTINE
       END
-! { dg-final { cleanup-modules "o_TYPE_DEFS TESTS" } }
+! { dg-final { cleanup-modules "o_type_defs tests" } }
diff --git a/gcc/testsuite/gfortran.dg/array_constructor_22.f90 b/gcc/testsuite/gfortran.dg/array_constructor_22.f90
index 0dcdaea..4744dcd 100644
--- a/gcc/testsuite/gfortran.dg/array_constructor_22.f90
+++ b/gcc/testsuite/gfortran.dg/array_constructor_22.f90
@@ -25,3 +25,4 @@  program len_test
 
    write(*,*) my_string(x) 
 end program len_test
+! { dg-final { cleanup-modules "test" } }
diff --git a/gcc/testsuite/gfortran.dg/array_constructor_26.f03 b/gcc/testsuite/gfortran.dg/array_constructor_26.f03
index 622bb51..18c08c4 100644
--- a/gcc/testsuite/gfortran.dg/array_constructor_26.f03
+++ b/gcc/testsuite/gfortran.dg/array_constructor_26.f03
@@ -16,4 +16,4 @@  MODULE WinData
   END TYPE TWindowData
 END MODULE WinData
 
-! { dg-final { cleanup-modules "WinData" } }
+! { dg-final { cleanup-modules "windata" } }
diff --git a/gcc/testsuite/gfortran.dg/array_function_4.f90 b/gcc/testsuite/gfortran.dg/array_function_4.f90
index c7e7d6e..20cb2d5 100644
--- a/gcc/testsuite/gfortran.dg/array_function_4.f90
+++ b/gcc/testsuite/gfortran.dg/array_function_4.f90
@@ -26,4 +26,4 @@  CONTAINS
   end function lenf
 END MODULE B1
 
-! { dg-final { cleanup-modules "B1" } }
+! { dg-final { cleanup-modules "b1" } }
diff --git a/gcc/testsuite/gfortran.dg/assumed_charlen_function_1.f90 b/gcc/testsuite/gfortran.dg/assumed_charlen_function_1.f90
index a28934e..13a79a6 100644
--- a/gcc/testsuite/gfortran.dg/assumed_charlen_function_1.f90
+++ b/gcc/testsuite/gfortran.dg/assumed_charlen_function_1.f90
@@ -77,4 +77,4 @@  end function not_OK
 
 END
 
-! { dg-final { cleanup-modules "M1" } }

+! { dg-final { cleanup-modules "m1" } }

diff --git a/gcc/testsuite/gfortran.dg/assumed_size_dt_dummy.f90 b/gcc/testsuite/gfortran.dg/assumed_size_dt_dummy.f90
index 1f45f24..7e84e9e 100644
--- a/gcc/testsuite/gfortran.dg/assumed_size_dt_dummy.f90
+++ b/gcc/testsuite/gfortran.dg/assumed_size_dt_dummy.f90
@@ -15,4 +15,4 @@  END MODULE TEST
 
 end
 
-! { dg-final { cleanup-modules "TEST" } }
+! { dg-final { cleanup-modules "test" } }
diff --git a/gcc/testsuite/gfortran.dg/bind_c_usage_15.f90 b/gcc/testsuite/gfortran.dg/bind_c_usage_15.f90
index c5201a6..55caba4 100644
--- a/gcc/testsuite/gfortran.dg/bind_c_usage_15.f90
+++ b/gcc/testsuite/gfortran.dg/bind_c_usage_15.f90
@@ -27,3 +27,5 @@  program main
   call gen(x)
   if(x /= 17) call abort()
 end program main
+
+! { dg-final { cleanup-modules "mod" } }
diff --git a/gcc/testsuite/gfortran.dg/bind_c_usage_16.f03 b/gcc/testsuite/gfortran.dg/bind_c_usage_16.f03
index 990918f..68b043c 100644
--- a/gcc/testsuite/gfortran.dg/bind_c_usage_16.f03
+++ b/gcc/testsuite/gfortran.dg/bind_c_usage_16.f03
@@ -55,3 +55,5 @@  subroutine test() bind(c)
     if(iachar(d(i)(2:2)) /=32 .or. iachar(d(i)(3:3)) /= 32) call abort()
   end do
 end subroutine
+
+! { dg-final { cleanup-modules "mod" } }
diff --git a/gcc/testsuite/gfortran.dg/bind_c_usage_3.f03 b/gcc/testsuite/gfortran.dg/bind_c_usage_3.f03
index 47f9d9a..8f07033 100644
--- a/gcc/testsuite/gfortran.dg/bind_c_usage_3.f03
+++ b/gcc/testsuite/gfortran.dg/bind_c_usage_3.f03
@@ -17,3 +17,4 @@  module test
   type(foo), bind(c) :: cp ! { dg-error "is not C interoperable" }
   real(c_double), pointer,bind(c) :: p ! { dg-error "cannot have both the POINTER and BIND.C." }
 end module test
+! { dg-final { cleanup-modules "test" } }
diff --git a/gcc/testsuite/gfortran.dg/binding_label_tests_7.f03 b/gcc/testsuite/gfortran.dg/binding_label_tests_7.f03
index 1234bb5..136fb5e 100644
--- a/gcc/testsuite/gfortran.dg/binding_label_tests_7.f03
+++ b/gcc/testsuite/gfortran.dg/binding_label_tests_7.f03
@@ -13,3 +13,5 @@  end interface
 
 call my_c_print()
 end program main
+
+! { dg-final { cleanup-modules "a" } }
diff --git a/gcc/testsuite/gfortran.dg/class_15.f03 b/gcc/testsuite/gfortran.dg/class_15.f03
index fbeb2a7..4520a59 100644
--- a/gcc/testsuite/gfortran.dg/class_15.f03
+++ b/gcc/testsuite/gfortran.dg/class_15.f03
@@ -40,4 +40,4 @@  module mod_D
   use mod_C
 end module
 
-! { dg-final { cleanup-modules "mod_A mod_B mod_C mod_D" } }
+! { dg-final { cleanup-modules "mod_a mod_b mod_c mod_d" } }
diff --git a/gcc/testsuite/gfortran.dg/class_27.f03 b/gcc/testsuite/gfortran.dg/class_27.f03
index c3a3c90..3525dc4 100644
--- a/gcc/testsuite/gfortran.dg/class_27.f03
+++ b/gcc/testsuite/gfortran.dg/class_27.f03
@@ -64,4 +64,4 @@  module type1_type
     end function Type1_initProc 
 end module type1_type
 
-! { dg-final { cleanup-modules "type2_type extended2A_type type1_type" } }
+! { dg-final { cleanup-modules "type2_type extended2a_type type1_type" } }
diff --git a/gcc/testsuite/gfortran.dg/class_33.f90 b/gcc/testsuite/gfortran.dg/class_33.f90
index b809fb1..7c3c197 100644
--- a/gcc/testsuite/gfortran.dg/class_33.f90
+++ b/gcc/testsuite/gfortran.dg/class_33.f90
@@ -10,4 +10,4 @@  module Molecular_Abundances_Structure
   class(molecularAbundancesStructure), pointer :: molecules
 end module
 
-! { dg-final { cleanup-modules "Molecular_Abundances_Structure" } }
+! { dg-final { cleanup-modules "molecular_abundances_structure" } }
diff --git a/gcc/testsuite/gfortran.dg/class_37.f03 b/gcc/testsuite/gfortran.dg/class_37.f03
index f951ea1..e3ff8ce 100644
--- a/gcc/testsuite/gfortran.dg/class_37.f03
+++ b/gcc/testsuite/gfortran.dg/class_37.f03
@@ -260,4 +260,4 @@  subroutine psb_cdall(ictxt, desc, info,mg,ng,vg,vl,flag,nl,repl, globalcheck)
 
 end subroutine psb_cdall
 
- 
+! { dg-final { cleanup-modules "psb_penv_mod psb_indx_map_mod psb_gen_block_map_mod psb_descriptor_type psb_cd_if_tools_mod psb_cd_tools_mod psb_base_tools_mod" } } 
diff --git a/gcc/testsuite/gfortran.dg/class_40.f03 b/gcc/testsuite/gfortran.dg/class_40.f03
index bd367df..dde1acd 100644
--- a/gcc/testsuite/gfortran.dg/class_40.f03
+++ b/gcc/testsuite/gfortran.dg/class_40.f03
@@ -33,4 +33,4 @@  program test
   call walk (node)
 end program
 
-! { dg-final { cleanup-modules "Tree_Nodes Merger_Trees Merger_Tree_Build" } }
+! { dg-final { cleanup-modules "tree_nodes merger_trees merger_tree_build" } }
diff --git a/gcc/testsuite/gfortran.dg/class_42.f03 b/gcc/testsuite/gfortran.dg/class_42.f03
index dd59835..cd3047f 100644
--- a/gcc/testsuite/gfortran.dg/class_42.f03
+++ b/gcc/testsuite/gfortran.dg/class_42.f03
@@ -13,4 +13,4 @@  contains
   end subroutine
 end module 
 
-! { dg-final { cleanup-modules "Overload_AnException_Impl" } }
+! { dg-final { cleanup-modules "overload_anexception_impl" } }
diff --git a/gcc/testsuite/gfortran.dg/class_defined_operator_1.f03 b/gcc/testsuite/gfortran.dg/class_defined_operator_1.f03
index 008739e..0b878f2 100644
--- a/gcc/testsuite/gfortran.dg/class_defined_operator_1.f03
+++ b/gcc/testsuite/gfortran.dg/class_defined_operator_1.f03
@@ -100,3 +100,5 @@  contains
    this = this*scale
  end subroutine
 end program
+
+! { dg-final { cleanup-modules "bar_module foo_module" } }
diff --git a/gcc/testsuite/gfortran.dg/coarray/registering_1.f90 b/gcc/testsuite/gfortran.dg/coarray/registering_1.f90
index a18ba61..c6bcf92 100644
--- a/gcc/testsuite/gfortran.dg/coarray/registering_1.f90
+++ b/gcc/testsuite/gfortran.dg/coarray/registering_1.f90
@@ -39,3 +39,5 @@  contains
      if (not_refed /= 784) call abort()
   end subroutine uncalled
 end subroutine test
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_token_1.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_token_1.f90
index 648a6a3..299986d 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lib_token_1.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_token_1.f90
@@ -55,7 +55,7 @@  end program main
 !      void * restrict caf_token.4, integer(kind=8) caf_offset.5,
 !      void * restrict caf_token.6, integer(kind=8) caf_offset.7)
 !
-! { dg-final { scan-tree-dump-times "sub \\(integer.kind=4. . restrict x1, integer.kind=4. . restrict x2, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+\\)" 1 "original"} }
+! { dg-final { scan-tree-dump-times "sub \\(integer.kind=4. . restrict x1, integer.kind=4. . restrict x2, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+\\)" 1 "original" } }
 !
 ! PROTOTYPE 2:
 !
@@ -63,26 +63,26 @@  end program main
 !       void * restrict caf_token.0, integer(kind=8) caf_offset.1,
 !       void * restrict caf_token.2, integer(kind=8) caf_offset.3)
 !
-! { dg-final { scan-tree-dump-times "sub2 \\(integer.kind=4. . restrict y1, integer.kind=4. . restrict y2, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+\\)" 1 "original"} }
+! { dg-final { scan-tree-dump-times "sub2 \\(integer.kind=4. . restrict y1, integer.kind=4. . restrict y2, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+\\)" 1 "original" } }
 !
 ! CALL 1
 !
 !  sub ((integer(kind=4) *) caf, &caf_dt->b, caf_token.9, 0, caf_token.10, 4);
 !
-! { dg-final { scan-tree-dump-times "sub \\(\[^,\]*caf, &caf_dt->b, caf_token.\[0-9\]+, 0, caf_token.\[0-9\]+, 4\\)" 1 "original"} }
+! { dg-final { scan-tree-dump-times "sub \\(\[^,\]*caf, &caf_dt->b, caf_token.\[0-9\]+, 0, caf_token.\[0-9\]+, 4\\)" 1 "original" } }
 !
 !  sub2 ((integer(kind=4) *) x1, (integer(kind=4) *) x2,
 !        caf_token.4, NON_LVALUE_EXPR <caf_offset.5>,
 !        caf_token.6, NON_LVALUE_EXPR <caf_offset.7>);
 !
-! { dg-final { scan-tree-dump-times "sub2 \\(\[^,\]*x1, \[^,\]*x2, caf_token.\[0-9]+, \[^,\]*caf_offset\[^,\]*, caf_token.\[0-9\]+, \[^,\]*caf_offset\[^,\]*\\)" 1 "original"} }
+! { dg-final { scan-tree-dump-times "sub2 \\(\[^,\]*x1, \[^,\]*x2, caf_token.\[0-9]+, \[^,\]*caf_offset\[^,\]*, caf_token.\[0-9\]+, \[^,\]*caf_offset\[^,\]*\\)" 1 "original" } }
 !
 ! CALL 3
 !
-! { dg-final { scan-tree-dump-times "sub_opt \\(0B, 0B, 0\\)" 1 "original"} }
+! { dg-final { scan-tree-dump-times "sub_opt \\(0B, 0B, 0\\)" 1 "original" } }
 !
 ! CALL 4
 !
-! { dg-final { scan-tree-dump-times "sub_opt \\(.integer.kind=4. .. caf, caf_token.\[0-9\]+, 0\\)" 1 "original"} }
+! { dg-final { scan-tree-dump-times "sub_opt \\(.integer.kind=4. .. caf, caf_token.\[0-9\]+, 0\\)" 1 "original" } }
 !
 ! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_token_2.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_token_2.f90
index dd37875..0631154 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lib_token_2.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_token_2.f90
@@ -81,7 +81,7 @@  end program main
 !      void * restrict caf_token.4, integer(kind=8) caf_offset.5,
 !      void * restrict caf_token.6, integer(kind=8) caf_offset.7)
 !
-! { dg-final { scan-tree-dump-times "sub \\(integer.kind=4. . restrict x1, integer.kind=4. . restrict x2, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+\\)" 1 "original"} }
+! { dg-final { scan-tree-dump-times "sub \\(integer.kind=4. . restrict x1, integer.kind=4. . restrict x2, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+\\)" 1 "original" } }
 !
 ! PROTOTYPE 2:
 !
@@ -89,27 +89,28 @@  end program main
 !       void * restrict caf_token.0, integer(kind=8) caf_offset.1,
 !       void * restrict caf_token.2, integer(kind=8) caf_offset.3)
 !
-! { dg-final { scan-tree-dump-times "sub2 \\(integer.kind=4. . restrict y1, integer.kind=4. . restrict y2, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+\\)" 1 "original"} }
+! { dg-final { scan-tree-dump-times "sub2 \\(integer.kind=4. . restrict y1, integer.kind=4. . restrict y2, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+, void . restrict caf_token.\[0-9\]+, integer.kind=.. caf_offset.\[0-9\]+\\)" 1 "original" } }
 !
 ! CALL 1
 !
 !  sub ((integer(kind=4) *) caf.data, &((struct t * restrict) caf_dt.data)->b,
 !       caf.token, 0, caf_dt.token, 4);
 !
-! { dg-final { scan-tree-dump-times "sub \\(\[^,\]*caf.data, &\[^,\]*caf_dt.data.->b, caf.token, 0, caf_dt.token, 4\\)" 1 "original"} }
+! { dg-final { scan-tree-dump-times "sub \\(\[^,\]*caf.data, &\[^,\]*caf_dt.data.->b, caf.token, 0, caf_dt.token, 4\\)" 1 "original" } }
 !
 !  sub2 ((integer(kind=4) *) x1, (integer(kind=4) *) x2,
 !        caf_token.4, NON_LVALUE_EXPR <caf_offset.5>,
 !        caf_token.6, NON_LVALUE_EXPR <caf_offset.7>);
 !
-! { dg-final { scan-tree-dump-times "sub2 \\(\[^,\]*x1, \[^,\]*x2, caf_token.\[0-9]+, \[^,\]*caf_offset\[^,\]*, caf_token.\[0-9\]+, \[^,\]*caf_offset\[^,\]*\\)" 1 "original"} }
+! { dg-final { scan-tree-dump-times "sub2 \\(\[^,\]*x1, \[^,\]*x2, caf_token.\[0-9]+, \[^,\]*caf_offset\[^,\]*, caf_token.\[0-9\]+, \[^,\]*caf_offset\[^,\]*\\)" 1 "original" } }
 !
 ! CALL 3
 !
-! { dg-final { scan-tree-dump-times "sub_opt \\(0B, 0B, 0\\)" 1 "original"} }
+! { dg-final { scan-tree-dump-times "sub_opt \\(0B, 0B, 0\\)" 1 "original" } }
 !
 ! CALL 4
 !
-! { dg-final { scan-tree-dump-times "sub_opt \\(.integer.kind=4. .. caf.data, caf.token, 0\\)" 1 "original"} }
+! { dg-final { scan-tree-dump-times "sub_opt \\(.integer.kind=4. .. caf.data, caf.token, 0\\)" 1 "original" } }
 !
 ! { dg-final { cleanup-tree-dump "original" } }
+! { dg-final { cleanup-modules "matrix_data" } }
diff --git a/gcc/testsuite/gfortran.dg/convert_1.f90 b/gcc/testsuite/gfortran.dg/convert_1.f90
index 87d3bab..97ebc65 100644
--- a/gcc/testsuite/gfortran.dg/convert_1.f90
+++ b/gcc/testsuite/gfortran.dg/convert_1.f90
@@ -15,4 +15,4 @@  USE MODULE_B
 a = 0
 END
 
-! { dg-final { cleanup-modules "MODULE_A MODULE_B" } }
+! { dg-final { cleanup-modules "module_a module_b" } }
diff --git a/gcc/testsuite/gfortran.dg/default_initialization_3.f90 b/gcc/testsuite/gfortran.dg/default_initialization_3.f90
index 4365198..720b355 100644
--- a/gcc/testsuite/gfortran.dg/default_initialization_3.f90
+++ b/gcc/testsuite/gfortran.dg/default_initialization_3.f90
@@ -105,4 +105,4 @@  END
   call other
   call dominique
 end
-! { dg-final { cleanup-modules "demo M1" } }
+! { dg-final { cleanup-modules "demo m1" } }
diff --git a/gcc/testsuite/gfortran.dg/dependency_25.f90 b/gcc/testsuite/gfortran.dg/dependency_25.f90
index 2576985..141811e 100644
--- a/gcc/testsuite/gfortran.dg/dependency_25.f90
+++ b/gcc/testsuite/gfortran.dg/dependency_25.f90
@@ -92,4 +92,4 @@  program TestProgram
   if (any (abs(Table%RealData(:,[1,2,3,5]) - 42) > epsilon(1.0))) call abort ()
 end program TestProgram
 
-! { dg-final { cleanup-modules "UnitValue_Module" } }
+! { dg-final { cleanup-modules "unitvalue_module" } }
diff --git a/gcc/testsuite/gfortran.dg/dependency_26.f90 b/gcc/testsuite/gfortran.dg/dependency_26.f90
index df909b4..0103d02 100644
--- a/gcc/testsuite/gfortran.dg/dependency_26.f90
+++ b/gcc/testsuite/gfortran.dg/dependency_26.f90
@@ -47,7 +47,7 @@  END MODULE M1
   cell%h = reshape ([(real(i), i = 1, 9)], [3, 3])
   call s1 (cell)
 end
-! { dg-final { cleanup-modules "M1" } }
+! { dg-final { cleanup-modules "m1" } }
 ! { dg-final { scan-tree-dump-times "&a" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "pack" 0 "original" } }
 ! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/dependency_36.f90 b/gcc/testsuite/gfortran.dg/dependency_36.f90
index f3c0ef7..920df2f 100644
--- a/gcc/testsuite/gfortran.dg/dependency_36.f90
+++ b/gcc/testsuite/gfortran.dg/dependency_36.f90
@@ -26,3 +26,5 @@  CONTAINS
     x = matmul(a,b)             ! { dg-warning "Creating array temporary" }
   END SUBROUTINE GeneticOptimize
 END MODULE m
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/dependency_37.f90 b/gcc/testsuite/gfortran.dg/dependency_37.f90
index 73721c9..a66f5af 100644
--- a/gcc/testsuite/gfortran.dg/dependency_37.f90
+++ b/gcc/testsuite/gfortran.dg/dependency_37.f90
@@ -46,4 +46,4 @@  program TestProgram
   Table%RealData = 1
   Table%RealData(:,1) = Table%RealData(:,1) * CENTIMETER
 end program TestProgram
-! { dg-final { cleanup-modules "UnitValue_Module" } }
+! { dg-final { cleanup-modules "unitvalue_module" } }
diff --git a/gcc/testsuite/gfortran.dg/derived_array_intrinisics_1.f90 b/gcc/testsuite/gfortran.dg/derived_array_intrinisics_1.f90
index 274aada..6056c83 100644
--- a/gcc/testsuite/gfortran.dg/derived_array_intrinisics_1.f90
+++ b/gcc/testsuite/gfortran.dg/derived_array_intrinisics_1.f90
@@ -29,3 +29,4 @@ 
   end
 ! { dg-final { scan-tree-dump-times "j = 50" 1 "original" } }
 ! { dg-final { cleanup-tree-dump "original" } }
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/dynamic_dispatch_10.f03 b/gcc/testsuite/gfortran.dg/dynamic_dispatch_10.f03
index 2b8e0fb..21cf140 100644
--- a/gcc/testsuite/gfortran.dg/dynamic_dispatch_10.f03
+++ b/gcc/testsuite/gfortran.dg/dynamic_dispatch_10.f03
@@ -168,4 +168,4 @@  program main
 
 end
 
-! { dg-final { cleanup-modules "BaseStrategy LaxWendroffStrategy KEStrategy" } }
+! { dg-final { cleanup-modules "basestrategy laxwendroffstrategy kestrategy" } }
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 207d76a..b9404a0 100644
--- a/gcc/testsuite/gfortran.dg/elemental_non_intrinsic_dummy_1.f90
+++ b/gcc/testsuite/gfortran.dg/elemental_non_intrinsic_dummy_1.f90
@@ -20,4 +20,4 @@  INTEGER FUNCTION SUB(XX)
   SUB=XX()
 END
 
-! { dg-final { cleanup-modules "TT" } }
+! { 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 ae18262..bce3452 100644
--- a/gcc/testsuite/gfortran.dg/elemental_pointer_1.f90
+++ b/gcc/testsuite/gfortran.dg/elemental_pointer_1.f90
@@ -10,4 +10,4 @@  CONTAINS
   END FUNCTION LL
 END MODULE Test
 
-! { dg-final { cleanup-modules "Test" } }
+! { dg-final { cleanup-modules "test" } }
diff --git a/gcc/testsuite/gfortran.dg/elemental_result_1.f90 b/gcc/testsuite/gfortran.dg/elemental_result_1.f90
index 2a6dee0..09f785a 100644
--- a/gcc/testsuite/gfortran.dg/elemental_result_1.f90
+++ b/gcc/testsuite/gfortran.dg/elemental_result_1.f90
@@ -18,4 +18,4 @@  CONTAINS
     INTEGER, pointer  :: MM ! { dg-error "conflicts with ELEMENTAL" }
   END FUNCTION MM
 END MODULE Test
-! { dg-final { cleanup-modules "Test" } }
+! { dg-final { cleanup-modules "test" } }
diff --git a/gcc/testsuite/gfortran.dg/empty_derived_type.f90 b/gcc/testsuite/gfortran.dg/empty_derived_type.f90
index 6bf616c..d6fad12 100644
--- a/gcc/testsuite/gfortran.dg/empty_derived_type.f90
+++ b/gcc/testsuite/gfortran.dg/empty_derived_type.f90
@@ -5,3 +5,5 @@  module stuff
       ! Empty!
    end type junk
 end module stuff 
+
+! { dg-final { cleanup-modules "stuff" } }
diff --git a/gcc/testsuite/gfortran.dg/entry_7.f90 b/gcc/testsuite/gfortran.dg/entry_7.f90
index b011fe6..6dd87f4 100644
--- a/gcc/testsuite/gfortran.dg/entry_7.f90
+++ b/gcc/testsuite/gfortran.dg/entry_7.f90
@@ -24,4 +24,4 @@  CONTAINS
 END MODULE TT
 
 
-! { dg-final { cleanup-modules "TT" } }
+! { dg-final { cleanup-modules "tt" } }
diff --git a/gcc/testsuite/gfortran.dg/entry_dummy_ref_2.f90 b/gcc/testsuite/gfortran.dg/entry_dummy_ref_2.f90
index 46dbdf6..20f1c10 100644
--- a/gcc/testsuite/gfortran.dg/entry_dummy_ref_2.f90
+++ b/gcc/testsuite/gfortran.dg/entry_dummy_ref_2.f90
@@ -17,4 +17,4 @@  END FUNCTION F1
 END  MODULE M1
 END
 
-! { dg-final { cleanup-modules "M1" } }
+! { dg-final { cleanup-modules "m1" } }
diff --git a/gcc/testsuite/gfortran.dg/equiv_constraint_3.f90 b/gcc/testsuite/gfortran.dg/equiv_constraint_3.f90
index 6d7c363..c39d144 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" } }
+! { dg-final { cleanup-modules "test" } }
diff --git a/gcc/testsuite/gfortran.dg/error_recovery_3.f90 b/gcc/testsuite/gfortran.dg/error_recovery_3.f90
index b1da9cb..35804be 100644
--- a/gcc/testsuite/gfortran.dg/error_recovery_3.f90
+++ b/gcc/testsuite/gfortran.dg/error_recovery_3.f90
@@ -7,5 +7,5 @@  MODULE M1
 END MODULE M1
 
 USE M1,                    ONLY: I,&! { dg-error "Missing" }
-! { dg-final { cleanup-modules "M1" } }
+! { dg-final { cleanup-modules "m1" } }
 
diff --git a/gcc/testsuite/gfortran.dg/extends_4.f03 b/gcc/testsuite/gfortran.dg/extends_4.f03
index 941a663..831c9eb 100644
--- a/gcc/testsuite/gfortran.dg/extends_4.f03
+++ b/gcc/testsuite/gfortran.dg/extends_4.f03
@@ -49,4 +49,4 @@  end module mymod
   call check_b (q%b)
 end
 
-! { dg-final { cleanup-modules "persons person_education" } }
+! { dg-final { cleanup-modules "mymod" } }
diff --git a/gcc/testsuite/gfortran.dg/func_assign.f90 b/gcc/testsuite/gfortran.dg/func_assign.f90
index 7ecf329..430198b 100644
--- a/gcc/testsuite/gfortran.dg/func_assign.f90
+++ b/gcc/testsuite/gfortran.dg/func_assign.f90
@@ -31,3 +31,5 @@  contains
 end module mod
 
 end
+
+! { dg-final { cleanup-modules "mod" } }
diff --git a/gcc/testsuite/gfortran.dg/func_assign_3.f90 b/gcc/testsuite/gfortran.dg/func_assign_3.f90
index 174cbc5..7846c87 100644
--- a/gcc/testsuite/gfortran.dg/func_assign_3.f90
+++ b/gcc/testsuite/gfortran.dg/func_assign_3.f90
@@ -29,4 +29,4 @@  program bugTest
   testCatch = testObj%test(2,2)  ! This would cause an ICE
   if (any (testCatch .ne. dble (reshape ([(i, i = 1, 4)],[2,2])))) call abort
 end program bugTest
-! { dg-final { cleanup-modules "bugTestMod" } }
+! { dg-final { cleanup-modules "bugtestmod" } }
diff --git a/gcc/testsuite/gfortran.dg/generic_1.f90 b/gcc/testsuite/gfortran.dg/generic_1.f90
index 12077da..6a7a6df 100644
--- a/gcc/testsuite/gfortran.dg/generic_1.f90
+++ b/gcc/testsuite/gfortran.dg/generic_1.f90
@@ -18,4 +18,4 @@  subroutine BAZ(X)
   use FOO
 end subroutine
 
-! { dg-final { cleanup-modules "FOO" } }
+! { dg-final { cleanup-modules "foo" } }
diff --git a/gcc/testsuite/gfortran.dg/generic_18.f90 b/gcc/testsuite/gfortran.dg/generic_18.f90
index 1e23838..695262b 100644
--- a/gcc/testsuite/gfortran.dg/generic_18.f90
+++ b/gcc/testsuite/gfortran.dg/generic_18.f90
@@ -51,4 +51,4 @@  END PROGRAM MakeAChoice
 ! { dg-final { scan-tree-dump-times "specproc" 3 "original" } }
 ! { dg-final { scan-tree-dump-times "elemproc" 3 "original" } }
 ! { dg-final { cleanup-tree-dump "original" } }
-! { dg-final { cleanup-modules "SomeOptions" } }
+! { dg-final { cleanup-modules "someoptions" } }
diff --git a/gcc/testsuite/gfortran.dg/generic_22.f03 b/gcc/testsuite/gfortran.dg/generic_22.f03
index 1da49de..487d93c 100644
--- a/gcc/testsuite/gfortran.dg/generic_22.f03
+++ b/gcc/testsuite/gfortran.dg/generic_22.f03
@@ -35,4 +35,4 @@  contains
 
 
 end module base_mod
-! { dg-final { cleanup-modules "m" } }
+! { dg-final { cleanup-modules "base_mod" } }
diff --git a/gcc/testsuite/gfortran.dg/generic_4.f90 b/gcc/testsuite/gfortran.dg/generic_4.f90
index 48c32a6..53cf900 100644
--- a/gcc/testsuite/gfortran.dg/generic_4.f90
+++ b/gcc/testsuite/gfortran.dg/generic_4.f90
@@ -27,4 +27,4 @@  call baz(y,z)
 if (any (y /= z)) call abort ()
 end
 
-! { dg-final { cleanup-modules "FOO" } }
+! { dg-final { cleanup-modules "foo" } }
diff --git a/gcc/testsuite/gfortran.dg/generic_6.f90 b/gcc/testsuite/gfortran.dg/generic_6.f90
index 9d08ac2..928861e 100644
--- a/gcc/testsuite/gfortran.dg/generic_6.f90
+++ b/gcc/testsuite/gfortran.dg/generic_6.f90
@@ -46,4 +46,4 @@  end module
   use c
   call useCreate
 end
-! { dg-final { cleanup-modules "A B C" } }
+! { dg-final { cleanup-modules "a b c" } }
diff --git a/gcc/testsuite/gfortran.dg/generic_actual_arg.f90 b/gcc/testsuite/gfortran.dg/generic_actual_arg.f90
index 17c5062..3f328c9 100644
--- a/gcc/testsuite/gfortran.dg/generic_actual_arg.f90
+++ b/gcc/testsuite/gfortran.dg/generic_actual_arg.f90
@@ -42,4 +42,4 @@  END
 
 SUBROUTINE F()
 END SUBROUTINE
-! { dg-final { cleanup-modules "TEST TEST2" } }
+! { dg-final { cleanup-modules "test test2" } }
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-21.f b/gcc/testsuite/gfortran.dg/graphite/id-21.f
index 4fa047e..e751934 100644
--- a/gcc/testsuite/gfortran.dg/graphite/id-21.f
+++ b/gcc/testsuite/gfortran.dg/graphite/id-21.f
@@ -18,3 +18,5 @@ 
          END DO
       ENDDO
       END
+
+! { dg-final { cleanup-modules "les3d_data" } }
diff --git a/gcc/testsuite/gfortran.dg/graphite/pr45758.f90 b/gcc/testsuite/gfortran.dg/graphite/pr45758.f90
index b0e0a3d..d6a1973 100644
--- a/gcc/testsuite/gfortran.dg/graphite/pr45758.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/pr45758.f90
@@ -38,4 +38,4 @@  CONTAINS
     ENDDO
   END SUBROUTINE create_destination_list
 END MODULE
-
+! { dg-final { cleanup-modules "util" } }
diff --git a/gcc/testsuite/gfortran.dg/host_assoc_call_2.f90 b/gcc/testsuite/gfortran.dg/host_assoc_call_2.f90
index a74f373..1175c46 100644
--- a/gcc/testsuite/gfortran.dg/host_assoc_call_2.f90
+++ b/gcc/testsuite/gfortran.dg/host_assoc_call_2.f90
@@ -15,4 +15,4 @@  contains
     call InitialDiatomicX ()    ! { dg-error "which is not consistent with the CALL" }
   end subroutine FindDiatomicPeriod
 end module Diatoms
-! { dg-final { cleanup-modules "Diatoms" } }
+! { dg-final { cleanup-modules "diatoms" } }
diff --git a/gcc/testsuite/gfortran.dg/host_assoc_call_3.f90 b/gcc/testsuite/gfortran.dg/host_assoc_call_3.f90
index 379b228..28c55bf 100644
--- a/gcc/testsuite/gfortran.dg/host_assoc_call_3.f90
+++ b/gcc/testsuite/gfortran.dg/host_assoc_call_3.f90
@@ -52,4 +52,4 @@  END MODULE
   CALL S3
   call S4
 END
-! { dg-final { cleanup-modules "M1 M2" } }
+! { dg-final { cleanup-modules "m1 m2" } }
diff --git a/gcc/testsuite/gfortran.dg/host_assoc_call_4.f90 b/gcc/testsuite/gfortran.dg/host_assoc_call_4.f90
index f97a644..50e1e3f 100644
--- a/gcc/testsuite/gfortran.dg/host_assoc_call_4.f90
+++ b/gcc/testsuite/gfortran.dg/host_assoc_call_4.f90
@@ -45,4 +45,4 @@  contains
     call GetBasicElementData (TargetElement, ProcedureName, ErrorNumber, ErrorLevel, ErrorMessage, CallingStat)
   end subroutine WH_ERR
 end module ErrorMod
-! { dg-final { cleanup-modules "ErrElmnt ErrorMod" } }
+! { dg-final { cleanup-modules "errelmnt errormod" } }
diff --git a/gcc/testsuite/gfortran.dg/host_assoc_function_4.f90 b/gcc/testsuite/gfortran.dg/host_assoc_function_4.f90
index 799eb00..73ad21a 100644
--- a/gcc/testsuite/gfortran.dg/host_assoc_function_4.f90
+++ b/gcc/testsuite/gfortran.dg/host_assoc_function_4.f90
@@ -27,4 +27,4 @@  END MODULE
   USE M2
   CALL S2
 END
-! { dg-final { cleanup-modules "M1 M2" } }
+! { dg-final { cleanup-modules "m1 m2" } }
diff --git a/gcc/testsuite/gfortran.dg/host_used_types_1.f90 b/gcc/testsuite/gfortran.dg/host_used_types_1.f90
index 528f6de..2076fdb 100644
--- a/gcc/testsuite/gfortran.dg/host_used_types_1.f90
+++ b/gcc/testsuite/gfortran.dg/host_used_types_1.f90
@@ -39,4 +39,4 @@  contains
 
 end module ThermoData
 
-! { dg-final { cleanup-modules "ModelParams 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 85398ca..21e9d21 100644
--- a/gcc/testsuite/gfortran.dg/implicit_1.f90
+++ b/gcc/testsuite/gfortran.dg/implicit_1.f90
@@ -9,4 +9,4 @@  implicit none
 common/rommel/aaa ! { dg-error "no IMPLICIT type" "no IMPLICIT type" }
 end
 
-! { dg-final { cleanup-modules "AHFinder_dat" } }
+! { dg-final { cleanup-modules "ahfinder_dat" } }
diff --git a/gcc/testsuite/gfortran.dg/implicit_11.f90 b/gcc/testsuite/gfortran.dg/implicit_11.f90
index d33acd1..be4ad6c 100644
--- a/gcc/testsuite/gfortran.dg/implicit_11.f90
+++ b/gcc/testsuite/gfortran.dg/implicit_11.f90
@@ -35,4 +35,4 @@ 
      END SUBROUTINE
      END MODULE tests2
 
-! { dg-final { cleanup-modules "TESTS" } }
+! { dg-final { cleanup-modules "tests" } }
diff --git a/gcc/testsuite/gfortran.dg/implicit_derived_type_1.f90 b/gcc/testsuite/gfortran.dg/implicit_derived_type_1.f90
index baa36d1..661eb83 100644
--- a/gcc/testsuite/gfortran.dg/implicit_derived_type_1.f90
+++ b/gcc/testsuite/gfortran.dg/implicit_derived_type_1.f90
@@ -18,3 +18,5 @@  contains
     print *, x(1)%i
   end subroutine s
 end module m
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/impure_actual_1.f90 b/gcc/testsuite/gfortran.dg/impure_actual_1.f90
index 43711d4..1f22c11 100644
--- a/gcc/testsuite/gfortran.dg/impure_actual_1.f90
+++ b/gcc/testsuite/gfortran.dg/impure_actual_1.f90
@@ -21,5 +21,5 @@  USE M1
  write(6,*) J(L) ! { dg-error "Expected a PURE procedure for argument" }
 END
 
-! { dg-final { cleanup-modules "M1" } }
+! { dg-final { cleanup-modules "m1" } }
 
diff --git a/gcc/testsuite/gfortran.dg/impure_assignment_1.f90 b/gcc/testsuite/gfortran.dg/impure_assignment_1.f90
index 6a1660c..28ef269 100644
--- a/gcc/testsuite/gfortran.dg/impure_assignment_1.f90
+++ b/gcc/testsuite/gfortran.dg/impure_assignment_1.f90
@@ -24,5 +24,5 @@  PURE SUBROUTINE S2(I,J)
      I=J                      ! { dg-error "is not PURE" }
 END SUBROUTINE S2
 END
-! { dg-final { cleanup-modules "M1" } }
+! { dg-final { cleanup-modules "m1" } }
 
diff --git a/gcc/testsuite/gfortran.dg/impure_constructor_1.f90 b/gcc/testsuite/gfortran.dg/impure_constructor_1.f90
index 6657213..56a34cd 100644
--- a/gcc/testsuite/gfortran.dg/impure_constructor_1.f90
+++ b/gcc/testsuite/gfortran.dg/impure_constructor_1.f90
@@ -27,4 +27,4 @@  contains
  end subroutine foo
 end module m
 
-
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/initialization_10.f90 b/gcc/testsuite/gfortran.dg/initialization_10.f90
index 92d9df5..387ea6d 100644
--- a/gcc/testsuite/gfortran.dg/initialization_10.f90
+++ b/gcc/testsuite/gfortran.dg/initialization_10.f90
@@ -29,4 +29,4 @@  end select
 END SUBROUTINE Parser
 END MODULE Readdata_mod
 
-! { dg-final { cleanup-modules "Readdata_mod" } }
+! { dg-final { cleanup-modules "readdata_mod" } }
diff --git a/gcc/testsuite/gfortran.dg/initialization_12.f90 b/gcc/testsuite/gfortran.dg/initialization_12.f90
index deef207..53db60b 100644
--- a/gcc/testsuite/gfortran.dg/initialization_12.f90
+++ b/gcc/testsuite/gfortran.dg/initialization_12.f90
@@ -26,4 +26,4 @@  module AtmoIonoSphere
   use AtmoIono
 end module AtmoIonoSphere
 
-! { dg-final { cleanup-modules "EGOPS_Utilities AtmoIono AtmoIonoSphere" } }
+! { dg-final { cleanup-modules "egops_utilities atmoiono atmoionosphere" } }
diff --git a/gcc/testsuite/gfortran.dg/interface_14.f90 b/gcc/testsuite/gfortran.dg/interface_14.f90
index ea4345b..994d97e 100644
--- a/gcc/testsuite/gfortran.dg/interface_14.f90
+++ b/gcc/testsuite/gfortran.dg/interface_14.f90
@@ -70,4 +70,4 @@ 
       call new (b)
       end
 
-! { dg-final { cleanup-modules "P_class S_Class T_Class D_Class poly_Class" } }
+! { dg-final { cleanup-modules "p_class s_class t_class d_class poly_class" } }
diff --git a/gcc/testsuite/gfortran.dg/interface_15.f90 b/gcc/testsuite/gfortran.dg/interface_15.f90
index 2186061..8ad940a 100644
--- a/gcc/testsuite/gfortran.dg/interface_15.f90
+++ b/gcc/testsuite/gfortran.dg/interface_15.f90
@@ -19,4 +19,4 @@  CONTAINS
   END FUNCTION
 END MODULE
 
-! { dg-final { cleanup-modules "M1" } }
+! { dg-final { cleanup-modules "m1" } }
diff --git a/gcc/testsuite/gfortran.dg/interface_2.f90 b/gcc/testsuite/gfortran.dg/interface_2.f90
index 4a813d0..4e63098 100644
--- a/gcc/testsuite/gfortran.dg/interface_2.f90
+++ b/gcc/testsuite/gfortran.dg/interface_2.f90
@@ -28,4 +28,4 @@  CONTAINS
 
 END MODULE Compare_Float_Numbers
 
-! { dg-final { cleanup-modules "Compare_Float_Numbers" } }
+! { dg-final { cleanup-modules "compare_float_numbers" } }
diff --git a/gcc/testsuite/gfortran.dg/interface_25.f90 b/gcc/testsuite/gfortran.dg/interface_25.f90
index 0118cd5..b239b21 100644
--- a/gcc/testsuite/gfortran.dg/interface_25.f90
+++ b/gcc/testsuite/gfortran.dg/interface_25.f90
@@ -43,3 +43,5 @@  CONTAINS
     end if
   END FUNCTION recSum
 END PROGRAM test
+
+! { dg-final { cleanup-modules "funcs" } }
diff --git a/gcc/testsuite/gfortran.dg/interface_26.f90 b/gcc/testsuite/gfortran.dg/interface_26.f90
index c1af6c6..c51dbd0 100644
--- a/gcc/testsuite/gfortran.dg/interface_26.f90
+++ b/gcc/testsuite/gfortran.dg/interface_26.f90
@@ -44,3 +44,5 @@  CONTAINS
     end if
   END FUNCTION recSum
 END PROGRAM test
+
+! { dg-final { cleanup-modules "funcs" } }
diff --git a/gcc/testsuite/gfortran.dg/interface_29.f90 b/gcc/testsuite/gfortran.dg/interface_29.f90
index e94571f..b3d123a 100644
--- a/gcc/testsuite/gfortran.dg/interface_29.f90
+++ b/gcc/testsuite/gfortran.dg/interface_29.f90
@@ -48,5 +48,5 @@  end subroutine bar
   end subroutine
 end module test
 
-! { dg-final { cleanup-modules "m" } }
+! { dg-final { cleanup-modules "m test" } }
 
diff --git a/gcc/testsuite/gfortran.dg/interface_assignment_1.f90 b/gcc/testsuite/gfortran.dg/interface_assignment_1.f90
index 6740ba1..5129832 100644
--- a/gcc/testsuite/gfortran.dg/interface_assignment_1.f90
+++ b/gcc/testsuite/gfortran.dg/interface_assignment_1.f90
@@ -36,4 +36,4 @@  CALL set(E,(E))
 IF (D%I.NE.4) call abort ()
 IF (4.NE.E%I) call abort ()
 END
-! { dg-final { cleanup-modules "TT" } }
+! { dg-final { cleanup-modules "tt" } }
diff --git a/gcc/testsuite/gfortran.dg/internal_pack_6.f90 b/gcc/testsuite/gfortran.dg/internal_pack_6.f90
index 51af726..05dd20a 100644
--- a/gcc/testsuite/gfortran.dg/internal_pack_6.f90
+++ b/gcc/testsuite/gfortran.dg/internal_pack_6.f90
@@ -54,6 +54,6 @@  END SUBROUTINE S2
 
  call s2
 end
-! { dg-final { cleanup-modules "M1" } }
+! { dg-final { cleanup-modules "m1" } }
 ! { dg-final { scan-tree-dump-times "_gfortran_internal_pack" 0 "original" } }
 ! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/internal_pack_7.f90 b/gcc/testsuite/gfortran.dg/internal_pack_7.f90
index 0bc30e5..32d98f7 100644
--- a/gcc/testsuite/gfortran.dg/internal_pack_7.f90
+++ b/gcc/testsuite/gfortran.dg/internal_pack_7.f90
@@ -30,6 +30,6 @@  CONTAINS
      s2=0
   END FUNCTION S2
 END MODULE M1
-! { dg-final { cleanup-modules "M1" } }
+! { dg-final { cleanup-modules "m1" } }
 ! { dg-final { scan-tree-dump-times "pack" 0 "original" } }
 ! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/internal_pack_8.f90 b/gcc/testsuite/gfortran.dg/internal_pack_8.f90
index 91d6a66..d38403f 100644
--- a/gcc/testsuite/gfortran.dg/internal_pack_8.f90
+++ b/gcc/testsuite/gfortran.dg/internal_pack_8.f90
@@ -30,4 +30,4 @@  END MODULE M1
 USE M1
 CALL S1
 END
-! { dg-final { cleanup-modules "M1" } }
+! { dg-final { cleanup-modules "m1" } }
diff --git a/gcc/testsuite/gfortran.dg/lto/pr45586_0.f90 b/gcc/testsuite/gfortran.dg/lto/pr45586_0.f90
index 84f3633..551ba6c 100644
--- a/gcc/testsuite/gfortran.dg/lto/pr45586_0.f90
+++ b/gcc/testsuite/gfortran.dg/lto/pr45586_0.f90
@@ -27,3 +27,5 @@ 
       CALL S1(x)
       write(6,*) x%r
       END
+
+! { dg-final { cleanup-modules "m1 m2" } }
diff --git a/gcc/testsuite/gfortran.dg/lto/pr47839_0.f90 b/gcc/testsuite/gfortran.dg/lto/pr47839_0.f90
index 9ea9315..ec7fe3f 100644
--- a/gcc/testsuite/gfortran.dg/lto/pr47839_0.f90
+++ b/gcc/testsuite/gfortran.dg/lto/pr47839_0.f90
@@ -6,3 +6,5 @@  MODULE globalvar_mod
 integer        :: xstop
 CONTAINS
 END MODULE globalvar_mod
+
+! { dg-final { cleanup-modules "globalvar_mod pec_mod" } }
diff --git a/gcc/testsuite/gfortran.dg/module_commons_3.f90 b/gcc/testsuite/gfortran.dg/module_commons_3.f90
index a57863e..e60cf9b 100644
--- a/gcc/testsuite/gfortran.dg/module_commons_3.f90
+++ b/gcc/testsuite/gfortran.dg/module_commons_3.f90
@@ -54,4 +54,4 @@  PROGRAM TEST1
   call BAR (T2)
   CALL FOOBAR (T2)
 END PROGRAM TEST1
-! { dg-final { cleanup-modules "TEST2 TEST3 TEST4" } }
+! { dg-final { cleanup-modules "test2 test3 test4" } }
diff --git a/gcc/testsuite/gfortran.dg/module_equivalence_4.f90 b/gcc/testsuite/gfortran.dg/module_equivalence_4.f90
index 7a8ef9c..c30fd52 100644
--- a/gcc/testsuite/gfortran.dg/module_equivalence_4.f90
+++ b/gcc/testsuite/gfortran.dg/module_equivalence_4.f90
@@ -26,4 +26,4 @@  end subroutine nudata
   call nudata (nlibe_, a_, l_)
 end
 
-! { dg-final { cleanup-modules "data_C" } }
+! { dg-final { cleanup-modules "data_c" } }
diff --git a/gcc/testsuite/gfortran.dg/module_equivalence_6.f90 b/gcc/testsuite/gfortran.dg/module_equivalence_6.f90
index c33a2ca..40e8b4b 100644
--- a/gcc/testsuite/gfortran.dg/module_equivalence_6.f90
+++ b/gcc/testsuite/gfortran.dg/module_equivalence_6.f90
@@ -19,4 +19,4 @@  PROGRAM fortranlibtest
   INTEGER :: ii
   ii = H5P_DEFAULT_F 
 END PROGRAM fortranlibtest
-! { dg-final { cleanup-modules "H5GLOBAL HDF5" } }
+! { dg-final { cleanup-modules "h5global hdf5" } }
diff --git a/gcc/testsuite/gfortran.dg/module_function_type_1.f90 b/gcc/testsuite/gfortran.dg/module_function_type_1.f90
index b0a4048..a1063b1 100644
--- a/gcc/testsuite/gfortran.dg/module_function_type_1.f90
+++ b/gcc/testsuite/gfortran.dg/module_function_type_1.f90
@@ -29,5 +29,5 @@  program C
   A_var = initA()
 end program C
 
-! { dg-final { cleanup-modules "A B" } }
+! { dg-final { cleanup-modules "a b" } }
 
diff --git a/gcc/testsuite/gfortran.dg/module_naming_1.f90 b/gcc/testsuite/gfortran.dg/module_naming_1.f90
index 7b9df0a..8024300 100644
--- a/gcc/testsuite/gfortran.dg/module_naming_1.f90
+++ b/gcc/testsuite/gfortran.dg/module_naming_1.f90
@@ -29,4 +29,4 @@  contains
     ! mangled to __m2_mod_m2_MOD_m3
   end subroutine m3
 end module m2_MOD_m2
-! { dg-final { cleanup-modules "m1 m1__m2 m2 m2_MOD_m2" } }
+! { dg-final { cleanup-modules "m1 m1__m2 m2 m2_mod_m2" } }
diff --git a/gcc/testsuite/gfortran.dg/namelist_4.f90 b/gcc/testsuite/gfortran.dg/namelist_4.f90
index 52a5bc9..ad4e1ab 100644
--- a/gcc/testsuite/gfortran.dg/namelist_4.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_4.f90
@@ -38,4 +38,4 @@  CONTAINS
   END FUNCTION
 END
 
-! { dg-final { cleanup-modules "M1" } }
+! { dg-final { cleanup-modules "m1" } }
diff --git a/gcc/testsuite/gfortran.dg/operator_c1202.f90 b/gcc/testsuite/gfortran.dg/operator_c1202.f90
index c53079a..ae5e126 100644
--- a/gcc/testsuite/gfortran.dg/operator_c1202.f90
+++ b/gcc/testsuite/gfortran.dg/operator_c1202.f90
@@ -66,3 +66,5 @@  module op
       end function f1
 
 end module op
+
+! { dg-final { cleanup-modules "op" } }
diff --git a/gcc/testsuite/gfortran.dg/parens_7.f90 b/gcc/testsuite/gfortran.dg/parens_7.f90
index daf5fdb..9cf9e5b 100644
--- a/gcc/testsuite/gfortran.dg/parens_7.f90
+++ b/gcc/testsuite/gfortran.dg/parens_7.f90
@@ -14,4 +14,6 @@  integer(kind=(int_t)) function test4() ! This failed before patch
 end function test4
 
  
-end program test
\ No newline at end of file
+end program test
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/pr32921.f b/gcc/testsuite/gfortran.dg/pr32921.f
index fe8e5c4..e809d6c 100644
--- a/gcc/testsuite/gfortran.dg/pr32921.f
+++ b/gcc/testsuite/gfortran.dg/pr32921.f
@@ -47,4 +47,4 @@ 
       END
 ! { dg-final { scan-tree-dump-times "stride" 4 "lim1" } }
 ! { dg-final { cleanup-tree-dump "lim1" } }
-! { dg-final { cleanup-modules "LES3D_DATA" } }
+! { dg-final { cleanup-modules "les3d_data" } }
diff --git a/gcc/testsuite/gfortran.dg/pr33646.f90 b/gcc/testsuite/gfortran.dg/pr33646.f90
index 13f65cb..15186b6 100644
--- a/gcc/testsuite/gfortran.dg/pr33646.f90
+++ b/gcc/testsuite/gfortran.dg/pr33646.f90
@@ -56,4 +56,4 @@  contains
    end subroutine
 end
 
-! { dg-final { cleanup-modules "BAR_MODULE FOO_MODULE" } }
+! { dg-final { cleanup-modules "bar_module foo_module" } }
diff --git a/gcc/testsuite/gfortran.dg/pr41928.f90 b/gcc/testsuite/gfortran.dg/pr41928.f90
index 2805c2d..3d0c25c 100644
--- a/gcc/testsuite/gfortran.dg/pr41928.f90
+++ b/gcc/testsuite/gfortran.dg/pr41928.f90
@@ -261,4 +261,4 @@  CONTAINS
     END DO
   END SUBROUTINE diff_momop
 END MODULE ai_moments
-! { dg-final { cleanup-modules "ai_moments" } }
+! { dg-final { cleanup-modules "kinds ai_moments" } }
diff --git a/gcc/testsuite/gfortran.dg/pr42119.f90 b/gcc/testsuite/gfortran.dg/pr42119.f90
index f848e9e..962181d 100644
--- a/gcc/testsuite/gfortran.dg/pr42119.f90
+++ b/gcc/testsuite/gfortran.dg/pr42119.f90
@@ -22,3 +22,4 @@  program Main
 
   call Check(C_FUNLOC(Callback))
 end program Main
+! { dg-final { cleanup-modules "test" } }
diff --git a/gcc/testsuite/gfortran.dg/pr43984.f90 b/gcc/testsuite/gfortran.dg/pr43984.f90
index 40c81b8..a4f151d 100644
--- a/gcc/testsuite/gfortran.dg/pr43984.f90
+++ b/gcc/testsuite/gfortran.dg/pr43984.f90
@@ -54,3 +54,4 @@  end
 
 ! { dg-final { scan-tree-dump-times "= iyz.data" 3 "pre" } }
 ! { dg-final { cleanup-tree-dump "pre" } }
+! { dg-final { cleanup-modules "test" } }
diff --git a/gcc/testsuite/gfortran.dg/present_1.f90 b/gcc/testsuite/gfortran.dg/present_1.f90
index 6dee264..a3850c4 100644
--- a/gcc/testsuite/gfortran.dg/present_1.f90
+++ b/gcc/testsuite/gfortran.dg/present_1.f90
@@ -17,4 +17,4 @@ 
   END SUBROUTINE S1
  END MODULE
  END
-! { dg-final { cleanup-modules "M1" } }
+! { dg-final { cleanup-modules "m1" } }
diff --git a/gcc/testsuite/gfortran.dg/private_type_2.f90 b/gcc/testsuite/gfortran.dg/private_type_2.f90
index cda00ca..f41e151 100644
--- a/gcc/testsuite/gfortran.dg/private_type_2.f90
+++ b/gcc/testsuite/gfortran.dg/private_type_2.f90
@@ -24,4 +24,4 @@  MODULE TEST
 END MODULE
 END
 
-! { dg-final { cleanup-modules "TEST" } }
+! { dg-final { cleanup-modules "test" } }
diff --git a/gcc/testsuite/gfortran.dg/proc_decl_2.f90 b/gcc/testsuite/gfortran.dg/proc_decl_2.f90
index a16b4db..1cbfe97 100644
--- a/gcc/testsuite/gfortran.dg/proc_decl_2.f90
+++ b/gcc/testsuite/gfortran.dg/proc_decl_2.f90
@@ -146,3 +146,5 @@  function p7(x)
  integer :: x, p7
  p7 = x*(-2)
 end function
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_10.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_10.f90
index 0ceedaa..e673efe 100644
--- a/gcc/testsuite/gfortran.dg/proc_ptr_10.f90
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_10.f90
@@ -27,4 +27,4 @@  program myProg
   call proc4( p )
 end program myProg
  
-! { dg-final { cleanup-modules "myMod" } }
+! { dg-final { cleanup-modules "mymod" } }
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_22.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_22.f90
index 3b1f5c6..1f13280 100644
--- a/gcc/testsuite/gfortran.dg/proc_ptr_22.f90
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_22.f90
@@ -26,5 +26,5 @@  program bugTest
   if (sum(pp2(3,2))/=6) call abort()
 end program bugTest
 
-! { dg-final { cleanup-modules "bugTestMod" } }
+! { dg-final { cleanup-modules "bugtestmod" } }
 
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_8.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_8.f90
index f45d114..55ba58d 100644
--- a/gcc/testsuite/gfortran.dg/proc_ptr_8.f90
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_8.f90
@@ -42,4 +42,4 @@  contains
 
 END
 
-! { dg-final { cleanup-modules "X" } }
+! { dg-final { cleanup-modules "x" } }
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_12.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_12.f90
index 5f26a78..41668b8 100644
--- a/gcc/testsuite/gfortran.dg/proc_ptr_comp_12.f90
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_12.f90
@@ -31,5 +31,5 @@  program bugTest
   if (sum(testObj%test(3,3))/=9) call abort()
 end program bugTest
 
-! { dg-final { cleanup-modules "bugTestMod" } }
+! { dg-final { cleanup-modules "bugtestmod" } }
 
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_6.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_6.f90
index 8898a59..4382a3b 100644
--- a/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_6.f90
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_6.f90
@@ -32,4 +32,4 @@  PROGRAM ProgA
   END DO
 END PROGRAM ProgA
 
-! { dg-final { cleanup-modules "ModA" } }
+! { dg-final { cleanup-modules "moda" } }
diff --git a/gcc/testsuite/gfortran.dg/pure_formal_proc_2.f90 b/gcc/testsuite/gfortran.dg/pure_formal_proc_2.f90
index ec7d06e..687e43e 100644
--- a/gcc/testsuite/gfortran.dg/pure_formal_proc_2.f90
+++ b/gcc/testsuite/gfortran.dg/pure_formal_proc_2.f90
@@ -45,4 +45,4 @@  program Test
   deallocate(pT1)
 
 end program Test
-! { dg-final { cleanup-modules "TestPure" } }
+! { dg-final { cleanup-modules "testpure" } }
diff --git a/gcc/testsuite/gfortran.dg/realloc_on_assign_4.f03 b/gcc/testsuite/gfortran.dg/realloc_on_assign_4.f03
index a71f5d5..682a81c 100644
--- a/gcc/testsuite/gfortran.dg/realloc_on_assign_4.f03
+++ b/gcc/testsuite/gfortran.dg/realloc_on_assign_4.f03
@@ -47,4 +47,5 @@  contains
   end function
 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 9a94bcd..1d0c0cd 100644
--- a/gcc/testsuite/gfortran.dg/substring_equivalence.f90
+++ b/gcc/testsuite/gfortran.dg/substring_equivalence.f90
@@ -7,4 +7,4 @@  module FLAGS
   equivalence ( encodings(1:1),at ), ( encodings(2:2),dev)
 end module FLAGS
 
-! { dg-final { cleanup-modules "FLAGS" } }
+! { dg-final { cleanup-modules "flags" } }
diff --git a/gcc/testsuite/gfortran.dg/transfer_assumed_size_1.f90 b/gcc/testsuite/gfortran.dg/transfer_assumed_size_1.f90
index f423188..1b0e156 100644
--- a/gcc/testsuite/gfortran.dg/transfer_assumed_size_1.f90
+++ b/gcc/testsuite/gfortran.dg/transfer_assumed_size_1.f90
@@ -41,5 +41,5 @@  program main
    call BytesToString( StringToBytes('Hi'), str )
    if (trim(str) .ne. "Hi") call abort ()
 end program
-! { dg-final { cleanup-modules "TransferBug" } }
+! { dg-final { cleanup-modules "transferbug" } }
 
diff --git a/gcc/testsuite/gfortran.dg/transpose_optimization_1.f90 b/gcc/testsuite/gfortran.dg/transpose_optimization_1.f90
index 885ff7c..d0ba6c4 100644
--- a/gcc/testsuite/gfortran.dg/transpose_optimization_1.f90
+++ b/gcc/testsuite/gfortran.dg/transpose_optimization_1.f90
@@ -104,3 +104,4 @@  end module foo
 
 ! { dg-final { scan-tree-dump-times "struct\[^\\n\]*atmp" 4 "original" } }
 ! { dg-final { cleanup-tree-dump "original" } }
+! { dg-final { cleanup-modules "foo" } }
diff --git a/gcc/testsuite/gfortran.dg/trim_optimize_5.f90 b/gcc/testsuite/gfortran.dg/trim_optimize_5.f90
index 70a85d6..40445e5 100644
--- a/gcc/testsuite/gfortran.dg/trim_optimize_5.f90
+++ b/gcc/testsuite/gfortran.dg/trim_optimize_5.f90
@@ -2,7 +2,6 @@ 
 ! { dg-options "-O -fdump-tree-original" }
 ! PR 47065 - replace trim with substring expressions even with references.
 program main
-  use foo
   implicit none
   type t
      character(len=2) :: x
diff --git a/gcc/testsuite/gfortran.dg/trim_optimize_6.f90 b/gcc/testsuite/gfortran.dg/trim_optimize_6.f90
index 2303bb4..2be4a34 100644
--- a/gcc/testsuite/gfortran.dg/trim_optimize_6.f90
+++ b/gcc/testsuite/gfortran.dg/trim_optimize_6.f90
@@ -23,3 +23,5 @@  program main
   if (line /= "aX          ") call abort
   if (f() .ne. 2) call abort
 end program main
+
+! { dg-final { cleanup-modules "foo" } }
diff --git a/gcc/testsuite/gfortran.dg/typebound_call_12.f03 b/gcc/testsuite/gfortran.dg/typebound_call_12.f03
index afb0fda..5591dd9 100644
--- a/gcc/testsuite/gfortran.dg/typebound_call_12.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_call_12.f03
@@ -33,4 +33,4 @@  PROGRAM ProgA
   END DO
 END PROGRAM ProgA
  
-! { dg-final { cleanup-modules "ModA" } }
+! { dg-final { cleanup-modules "moda" } }
diff --git a/gcc/testsuite/gfortran.dg/typebound_operator_5.f03 b/gcc/testsuite/gfortran.dg/typebound_operator_5.f03
index 440c1b5..25a8c38 100644
--- a/gcc/testsuite/gfortran.dg/typebound_operator_5.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_operator_5.f03
@@ -27,4 +27,4 @@  PROGRAM P
   PRINT *, A%PT .LT. B%PT
 END
 
-! { dg-final { cleanup-modules "DEF1" } }
+! { dg-final { cleanup-modules "def1" } }
diff --git a/gcc/testsuite/gfortran.dg/typebound_operator_6.f03 b/gcc/testsuite/gfortran.dg/typebound_operator_6.f03
index b2c3ee8..132b32b 100644
--- a/gcc/testsuite/gfortran.dg/typebound_operator_6.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_operator_6.f03
@@ -70,4 +70,4 @@  PROGRAM TEST
   if (.NOT. NDA .LT. NDB) call abort()
 END
 
-! { dg-final { cleanup-modules "DAT_MOD NODE_MOD" } }
+! { dg-final { cleanup-modules "dat_mod node_mod" } }
diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_18.f03 b/gcc/testsuite/gfortran.dg/typebound_proc_18.f03
index 4ddd178..956c02e 100644
--- a/gcc/testsuite/gfortran.dg/typebound_proc_18.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_proc_18.f03
@@ -26,4 +26,4 @@  contains
 
 end module Merger_Trees
 
-! { dg-final { cleanup-modules "Merger_Trees" } }
+! { dg-final { cleanup-modules "merger_trees" } }
diff --git a/gcc/testsuite/gfortran.dg/unreferenced_use_assoc_1.f90 b/gcc/testsuite/gfortran.dg/unreferenced_use_assoc_1.f90
index 57892d5..b2fdd79 100644
--- a/gcc/testsuite/gfortran.dg/unreferenced_use_assoc_1.f90
+++ b/gcc/testsuite/gfortran.dg/unreferenced_use_assoc_1.f90
@@ -37,4 +37,4 @@  program main
    call DoSomethingWithBytes( UserTypeToBytes(user) )
 
 end program 
-! { dg-final { cleanup-modules "InternalCompilerError" } }
+! { dg-final { cleanup-modules "internalcompilererror" } }
diff --git a/gcc/testsuite/gfortran.dg/use_1.f90 b/gcc/testsuite/gfortran.dg/use_1.f90
index 94d5db2..2750d10 100644
--- a/gcc/testsuite/gfortran.dg/use_1.f90
+++ b/gcc/testsuite/gfortran.dg/use_1.f90
@@ -6,4 +6,4 @@ 
       subroutine bar1
       usefoo
       end
-      ! { dg-final { cleanup-modules "iso_fortran_env" } }
+      ! { dg-final { cleanup-modules "foo" } }
diff --git a/gcc/testsuite/gfortran.dg/use_10.f90 b/gcc/testsuite/gfortran.dg/use_10.f90
index e52fcff..3c752ed 100644
--- a/gcc/testsuite/gfortran.dg/use_10.f90
+++ b/gcc/testsuite/gfortran.dg/use_10.f90
@@ -27,3 +27,5 @@  operator(.my.)=>operator(.op.),operator(.ops.)=>operator(.op.)
 implicit none
 if (.my.2 /= -2 .or. .op.3 /= -3 .or. .ops.7 /= -7) call abort()
 end
+
+! { dg-final { cleanup-modules "a" } }
diff --git a/gcc/testsuite/gfortran.dg/use_11.f90 b/gcc/testsuite/gfortran.dg/use_11.f90
index 02efe8e..ba7cf09 100644
--- a/gcc/testsuite/gfortran.dg/use_11.f90
+++ b/gcc/testsuite/gfortran.dg/use_11.f90
@@ -15,4 +15,4 @@  local1 = 5
 local2 = 3
 if (local1 .ne. local2) call abort ()
 end
-! { dg-final { cleanup-modules "test" } }
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/use_14.f90 b/gcc/testsuite/gfortran.dg/use_14.f90
index 63f3dff..4ea5aed 100644
--- a/gcc/testsuite/gfortran.dg/use_14.f90
+++ b/gcc/testsuite/gfortran.dg/use_14.f90
@@ -17,3 +17,5 @@  subroutine my_sub (a)
 end subroutine
 
 END
+
+! { dg-final { cleanup-modules "test_mod" } }
diff --git a/gcc/testsuite/gfortran.dg/use_only_2.f90 b/gcc/testsuite/gfortran.dg/use_only_2.f90
index 313953e..a2bfb30 100644
--- a/gcc/testsuite/gfortran.dg/use_only_2.f90
+++ b/gcc/testsuite/gfortran.dg/use_only_2.f90
@@ -27,4 +27,4 @@  end module MyMod3
 module MyMod4
   USE MyMod3, only: write_MyInt
 end module MYMOD4
-! { dg-final { cleanup-modules "MyMod1 MyMod2 MyMod3 MyMod4" } }
+! { dg-final { cleanup-modules "mymod1 mymod2 mymod3 mymod4" } }
diff --git a/gcc/testsuite/gfortran.dg/use_rename_4.f90 b/gcc/testsuite/gfortran.dg/use_rename_4.f90
index e0e83b8..4ce7104 100644
--- a/gcc/testsuite/gfortran.dg/use_rename_4.f90
+++ b/gcc/testsuite/gfortran.dg/use_rename_4.f90
@@ -20,3 +20,5 @@  PROGRAM main
     CALL abort ()
   END IF
 END PROGRAM main
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/use_rename_5.f90 b/gcc/testsuite/gfortran.dg/use_rename_5.f90
index 3d7839a..09f87c4 100644
--- a/gcc/testsuite/gfortran.dg/use_rename_5.f90
+++ b/gcc/testsuite/gfortran.dg/use_rename_5.f90
@@ -15,3 +15,5 @@  PROGRAM main
   i = 4 ! { dg-error "no IMPLICIT type" }
   j = 5
 END PROGRAM main
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/used_dummy_types_3.f90 b/gcc/testsuite/gfortran.dg/used_dummy_types_3.f90
index a308c0e..c7e373a 100644
--- a/gcc/testsuite/gfortran.dg/used_dummy_types_3.f90
+++ b/gcc/testsuite/gfortran.dg/used_dummy_types_3.f90
@@ -34,4 +34,4 @@ 
     CALL TEST(x)         ! { dg-error "Type mismatch in argument" }
   END
 
-! { dg-final { cleanup-modules "T1 T2" } }
+! { dg-final { cleanup-modules "t1 t2" } }
diff --git a/gcc/testsuite/gfortran.dg/used_interface_ref.f90 b/gcc/testsuite/gfortran.dg/used_interface_ref.f90
index 3e0290c..10746c7 100644
--- a/gcc/testsuite/gfortran.dg/used_interface_ref.f90
+++ b/gcc/testsuite/gfortran.dg/used_interface_ref.f90
@@ -44,4 +44,4 @@ 
     solveCConvert = (/(real(i), i = 1, anzKomponenten)/)
   END FUNCTION solveCConvert
 
-! { dg-final { cleanup-modules "MODULE_CONC MODULE_THERMOCALC" } }
+! { dg-final { cleanup-modules "module_conc module_thermocalc" } }
diff --git a/gcc/testsuite/gfortran.dg/used_types_11.f90 b/gcc/testsuite/gfortran.dg/used_types_11.f90
index b820dc5..0cae5f1 100644
--- a/gcc/testsuite/gfortran.dg/used_types_11.f90
+++ b/gcc/testsuite/gfortran.dg/used_types_11.f90
@@ -35,4 +35,4 @@  end subroutine bar
   x => foo ()
   print *, associated (x)
 end
-! { dg-final { cleanup-modules "A B" } }
+! { dg-final { cleanup-modules "a b" } }
diff --git a/gcc/testsuite/gfortran.dg/used_types_3.f90 b/gcc/testsuite/gfortran.dg/used_types_3.f90
index 68d112b..812db11 100644
--- a/gcc/testsuite/gfortran.dg/used_types_3.f90
+++ b/gcc/testsuite/gfortran.dg/used_types_3.f90
@@ -55,4 +55,4 @@  ofTypB => a%ofTypA
 a%ofTypA(i,j) = ofTypB(k,j)
 end subroutine buggy
 end module modC
-! { dg-final { cleanup-modules "modA modB modC" } }
+! { dg-final { cleanup-modules "moda modb modc" } }
diff --git a/gcc/testsuite/gfortran.dg/used_types_4.f90 b/gcc/testsuite/gfortran.dg/used_types_4.f90
index a08fd0f..58877c6 100644
--- a/gcc/testsuite/gfortran.dg/used_types_4.f90
+++ b/gcc/testsuite/gfortran.dg/used_types_4.f90
@@ -37,4 +37,4 @@  contains
     call InitRECFAST(CP%omegab,CP%h0,CP%tcmb,CP%yhe)
   end subroutine inithermo
 end module ThermoData
-! { dg-final { cleanup-modules "PRECISION ModelParams TimeSteps ThermoData" } }
+! { dg-final { cleanup-modules "precision modelparams timesteps thermodata" } }
diff --git a/gcc/testsuite/gfortran.dg/userdef_operator_2.f90 b/gcc/testsuite/gfortran.dg/userdef_operator_2.f90
index 83392c6..5b294c3 100644
--- a/gcc/testsuite/gfortran.dg/userdef_operator_2.f90
+++ b/gcc/testsuite/gfortran.dg/userdef_operator_2.f90
@@ -15,3 +15,5 @@  contains
     print*, a .myop. b
   end subroutine test_fn
 end module test_mod
+
+! { dg-final { cleanup-modules "test_mod" } }
diff --git a/gcc/testsuite/gfortran.dg/vect/fast-math-vect-8.f90 b/gcc/testsuite/gfortran.dg/vect/fast-math-vect-8.f90
index 26d850d..a5436b7 100644
--- a/gcc/testsuite/gfortran.dg/vect/fast-math-vect-8.f90
+++ b/gcc/testsuite/gfortran.dg/vect/fast-math-vect-8.f90
@@ -92,3 +92,4 @@  end module solv_cap
 
 ! { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_intfloat_cvt } } }
 ! { dg-final { cleanup-tree-dump "vect" } } 
+! { dg-final { cleanup-modules "solv_cap" } }
diff --git a/gcc/testsuite/gfortran.dg/vect/pr46213.f90 b/gcc/testsuite/gfortran.dg/vect/pr46213.f90
index 504d1a3..2eb12dd 100644
--- a/gcc/testsuite/gfortran.dg/vect/pr46213.f90
+++ b/gcc/testsuite/gfortran.dg/vect/pr46213.f90
@@ -23,3 +23,4 @@  contains
 end program test
 
 ! { dg-final { cleanup-tree-dump "vect" } }
+! { dg-final { cleanup-modules "foo" } }
diff --git a/gcc/testsuite/gfortran.dg/whole_file_21.f90 b/gcc/testsuite/gfortran.dg/whole_file_21.f90
index 2bd979d..ec9256a 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_21.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_21.f90
@@ -24,4 +24,4 @@  CONTAINS
 END MODULE mod
 END
 
-! { dg-final { cleanup-modules "m" } }
+! { dg-final { cleanup-modules "mod" } }
diff --git a/gcc/testsuite/gfortran.dg/whole_file_22.f90 b/gcc/testsuite/gfortran.dg/whole_file_22.f90
index 4e22920..d833491 100644
--- a/gcc/testsuite/gfortran.dg/whole_file_22.f90
+++ b/gcc/testsuite/gfortran.dg/whole_file_22.f90
@@ -36,3 +36,4 @@  USE M
 CALL b()
 END
 
+! { dg-final { cleanup-modules "m" } }