aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2020-06-13 10:04:33 +0200
committerThomas Koenig <tkoenig@gcc.gnu.org>2020-06-13 10:04:33 +0200
commit0cfc34ad1293a5e19f1dc67c461c58d99222ac9d (patch)
treeb27cbf349ca11ddc9581070366a4b19fd0192521 /gcc
parent8e3b453e0877288685695ca3e927a2da3b5f5b78 (diff)
downloadgcc-0cfc34ad1293a5e19f1dc67c461c58d99222ac9d.zip
gcc-0cfc34ad1293a5e19f1dc67c461c58d99222ac9d.tar.gz
gcc-0cfc34ad1293a5e19f1dc67c461c58d99222ac9d.tar.bz2
Disable -Wstringop-overflow warning after checking code path of caller.
The warning that is disabled, only on this single line, has been inspected and found to be not applicable; it is known that the size of the buffer is safe. libgfortran/ChangeLog: 2020-06-13 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/95313 * io/write.c (ztoa_big): Disable -Wstringop-overflow for one line.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gfortran.dg/finalize_36.f9039
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/finalize_36.f90 b/gcc/testsuite/gfortran.dg/finalize_36.f90
new file mode 100644
index 0000000..432f547
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/finalize_36.f90
@@ -0,0 +1,39 @@
+! { dg-do run }
+! { dg-additional-options "-fdump-tree-original" }
+! PR 94109
+! This used to leak memory. Test case by Antony Lewis.
+ module debug
+ implicit none
+
+ Type Tester
+ real, dimension(:), allocatable :: Dat, Dat2
+ end Type
+
+ Type TestType2
+ Type(Tester) :: T
+ end type TestType2
+
+ contains
+
+ subroutine Leaker
+ class(TestType2), pointer :: ActiveState
+ Type(Tester) :: Temp
+
+ allocate(Temp%Dat2(10000))
+
+ allocate(TestType2::ActiveState)
+ ActiveState%T = Temp
+ deallocate(ActiveState)
+
+ end subroutine
+
+ end module
+
+
+ program run
+ use debug
+
+ call Leaker()
+
+ end program
+! { dg-final { scan-tree-dump-times "__builtin_free\\ \\(ptr2" 4 "original" } }