aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2005-06-11 22:33:11 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2005-06-11 22:33:11 +0000
commit94631c1e45858279aadabb6f9608d06beb92f9fd (patch)
treebffc7b10caad9deb8a33c38c11402d962864d70f /gcc
parent411e6c1e103bd087cce5a006b3e15622aa9ac83c (diff)
downloadgcc-94631c1e45858279aadabb6f9608d06beb92f9fd.zip
gcc-94631c1e45858279aadabb6f9608d06beb92f9fd.tar.gz
gcc-94631c1e45858279aadabb6f9608d06beb92f9fd.tar.bz2
re PR fortran/17792 ([4.0 only] deallocate does not return stat)
PR fortran/17792 PR fortran/21375 * gfortran.dg/deallocate_statO.f90: New test. From-SVN: r100847
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gfortran.dg/deallocate_stat.f9077
2 files changed, 84 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1dced9a..6140b21 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,4 +1,10 @@
-2005-05-11 Thomas Koenig <Thomas.Koenig@online.de>
+2005-06-11 Steven G. Kargl <kargls@comcast.net>
+
+ PR fortran/17792
+ PR fortran/21375
+ * gfortran.dg/deallocate_stat.f90: New test.
+
+2005-06-11 Thomas Koenig <Thomas.Koenig@online.de>
* gfortran.fortran-torture/execute/in-pack.f90: New test.
diff --git a/gcc/testsuite/gfortran.dg/deallocate_stat.f90 b/gcc/testsuite/gfortran.dg/deallocate_stat.f90
new file mode 100644
index 0000000..b691f21
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/deallocate_stat.f90
@@ -0,0 +1,77 @@
+! { dg-do run }
+! PR 17792
+! PR 21375
+! Test that the STAT argument to DEALLOCATE works with POINTERS and
+! ALLOCATABLE arrays.
+program deallocate_stat
+
+ implicit none
+
+ integer i
+ real, pointer :: a1(:), a2(:,:), a3(:,:,:), a4(:,:,:,:), &
+ & a5(:,:,:,:,:), a6(:,:,:,:,:,:), a7(:,:,:,:,:,:,:)
+
+ real, allocatable :: b1(:), b2(:,:), b3(:,:,:), b4(:,:,:,:), &
+ & b5(:,:,:,:,:), b6(:,:,:,:,:,:), b7(:,:,:,:,:,:,:)
+
+ allocate(a1(2), a2(2,2), a3(2,2,2), a4(2,2,2,2), a5(2,2,2,2,2))
+ allocate(a6(2,2,2,2,2,2), a7(2,2,2,2,2,2,2))
+
+ a1 = 1. ; a2 = 2. ; a3 = 3. ; a4 = 4. ; a5 = 5. ; a6 = 6. ; a7 = 7.
+
+ i = 13
+ deallocate(a1, stat=i) ; if (i /= 0) call abort
+ deallocate(a2, stat=i) ; if (i /= 0) call abort
+ deallocate(a3, stat=i) ; if (i /= 0) call abort
+ deallocate(a4, stat=i) ; if (i /= 0) call abort
+ deallocate(a5, stat=i) ; if (i /= 0) call abort
+ deallocate(a6, stat=i) ; if (i /= 0) call abort
+ deallocate(a7, stat=i) ; if (i /= 0) call abort
+
+ i = 14
+ deallocate(a1, stat=i) ; if (i /= 1) call abort
+ deallocate(a2, stat=i) ; if (i /= 1) call abort
+ deallocate(a3, stat=i) ; if (i /= 1) call abort
+ deallocate(a4, stat=i) ; if (i /= 1) call abort
+ deallocate(a5, stat=i) ; if (i /= 1) call abort
+ deallocate(a6, stat=i) ; if (i /= 1) call abort
+ deallocate(a7, stat=i) ; if (i /= 1) call abort
+
+ allocate(b1(2), b2(2,2), b3(2,2,2), b4(2,2,2,2), b5(2,2,2,2,2))
+ allocate(b6(2,2,2,2,2,2), b7(2,2,2,2,2,2,2))
+
+ b1 = 1. ; b2 = 2. ; b3 = 3. ; b4 = 4. ; b5 = 5. ; b6 = 6. ; b7 = 7.
+
+ i = 13
+ deallocate(b1, stat=i) ; if (i /= 0) call abort
+ deallocate(b2, stat=i) ; if (i /= 0) call abort
+ deallocate(b3, stat=i) ; if (i /= 0) call abort
+ deallocate(b4, stat=i) ; if (i /= 0) call abort
+ deallocate(b5, stat=i) ; if (i /= 0) call abort
+ deallocate(b6, stat=i) ; if (i /= 0) call abort
+ deallocate(b7, stat=i) ; if (i /= 0) call abort
+
+ i = 14
+ deallocate(b1, stat=i) ; if (i /= 1) call abort
+ deallocate(b2, stat=i) ; if (i /= 1) call abort
+ deallocate(b3, stat=i) ; if (i /= 1) call abort
+ deallocate(b4, stat=i) ; if (i /= 1) call abort
+ deallocate(b5, stat=i) ; if (i /= 1) call abort
+ deallocate(b6, stat=i) ; if (i /= 1) call abort
+ deallocate(b7, stat=i) ; if (i /= 1) call abort
+
+
+ allocate(a1(2), a2(2,2), a3(2,2,2), b4(2,2,2,2), b5(2,2,2,2,2))
+ allocate(b6(2,2,2,2,2,2))
+
+ a1 = 1. ; a2 = 2. ; a3 = 3. ; b4 = 4. ; b5 = 5. ; b6 = 6.
+
+ i = 13
+ deallocate(a1, stat=i) ; if (i /= 0) call abort
+ deallocate(a2, a1, stat=i) ; if (i /= 1) call abort
+ deallocate(a1, a3, a2, stat=i) ; if (i /= 2) call abort
+ deallocate(b4, stat=i) ; if (i /= 0) call abort
+ deallocate(b4, b5, stat=i) ; if (i /= 1) call abort
+ deallocate(b4, b5, b6, stat=i) ; if (i /= 2) call abort
+
+end program deallocate_stat