This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran, committed] PR57762 - Fix memleak in gfortran.dg/class_array_7.f03


That's a patch of the category: Make the testers happy (here: Dominque).

gfortran (in GCC 4.9) no longer frees allocatable at the end of the main program as they get implicitly the SAVE attribute (cf. Fortran 2008) - and that's now detectable due to finalizers.

Result: gfortran.dg/class_array_7.f03 now leaks memory, which clutters the valgrind output of the test suite. As the test itself is agnostic to a tailing deallocate, I added one.

Committed as Rev. 201137.

Tobias
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(Revision 201136)
+++ gcc/testsuite/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,8 @@
+2013-07-22  Tobias Burnus  <burnus@net-b.de>
+
+	PR fortran/57762
+	* gfortran.dg/class_array_7.f03: Fix memory leak.
+
 2013-07-22  Paolo Carlini  <paolo.carlini@oracle.com>
 
 	PR c++/52816
Index: gcc/testsuite/gfortran.dg/class_array_7.f03
===================================================================
--- gcc/testsuite/gfortran.dg/class_array_7.f03	(Revision 201136)
+++ gcc/testsuite/gfortran.dg/class_array_7.f03	(Arbeitskopie)
@@ -54,4 +54,5 @@ program main
   if (trim (print_type ("a", a)) .ne. "a is extended_type") call abort
   call reallocate (a)
   if (trim (print_type ("a", a)) .ne. "a is base_type") call abort
+  deallocate (a)
 end program main
module VEC_REAL_MODULE
contains
   pure function VEC_REAL_norm(self) result(res)
     real, dimension(:), intent(in) :: self
     res = self(1)
   end function
   function MAT_REAL_row_norms(self) result(res)
      real, dimension(:,:) :: self
      real, dimension(size(self,1)) :: res
      do i = 1,size(self,1)
         res(i) = VEC_REAL_norm(self(i,:))
      end do
   end function
   pure subroutine MAT_REAL_zero_small_values(self,eps)
   real(8), dimension(:,:) :: self
      intent(inout) :: self
      real(8), intent(in) :: eps
      where (abs(self)<eps)
      end where
   end subroutine
end module

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]