summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/pack_bounds_1.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/pack_bounds_1.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/pack_bounds_1.f9010
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/pack_bounds_1.f90 b/gcc/testsuite/gfortran.dg/pack_bounds_1.f90
new file mode 100644
index 000000000..d1e185cc4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pack_bounds_1.f90
@@ -0,0 +1,10 @@
+! { dg-do run }
+! { dg-options "-fbounds-check" }
+! { dg-shouldfail "Incorrect extent in return value of PACK intrinsic; is 4, should be 5" }
+! PR 30814 - a bounds error with pack was not caught.
+program main
+ integer :: a(2,2), b(5)
+ a = reshape((/ 1, -1, 1, -1 /), shape(a))
+ b = pack(a, a /= 0)
+end program main
+! { dg-output "Fortran runtime error: Incorrect extent in return value of PACK intrinsic; is 4, should be 5" }