summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/deallocate_error_2.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/deallocate_error_2.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/deallocate_error_2.f9016
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/deallocate_error_2.f90 b/gcc/testsuite/gfortran.dg/deallocate_error_2.f90
new file mode 100644
index 000000000..bda1adff5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/deallocate_error_2.f90
@@ -0,0 +1,16 @@
+! { dg-do run }
+! { dg-shouldfail "runtime error" }
+! { dg-output "At line 15.*Attempt to DEALLOCATE unallocated 'ptr'" }
+
+! PR fortran/37507
+! Check that locus is printed for DEALLOCATE errors.
+
+PROGRAM main
+ IMPLICIT NONE
+ INTEGER, POINTER :: ptr
+ INTEGER, ALLOCATABLE :: arr(:)
+
+ ALLOCATE (ptr, arr(5))
+ DEALLOCATE (ptr)
+ DEALLOCATE (arr, ptr)
+END PROGRAM main