summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/entry_array_specs_2.f
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/entry_array_specs_2.f')
-rw-r--r--gcc/testsuite/gfortran.dg/entry_array_specs_2.f31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/entry_array_specs_2.f b/gcc/testsuite/gfortran.dg/entry_array_specs_2.f
new file mode 100644
index 000000000..ba4de318c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/entry_array_specs_2.f
@@ -0,0 +1,31 @@
+! { dg-do run }
+! Tests the patch for PR30025, aka 25818, in which the initialization
+! code for the array a, was causing a segfault in runtime for a call
+! to x, since n is missing.
+!
+! COntributed by Elizabeth Yip <elizabeth.l.yip@boeing.com>
+ program test_entry
+ common // j
+ real a(10)
+ a(1) = 999.
+ call x
+ if (j .ne. 1) call abort ()
+ call y(a,10)
+ if (j .ne. 2) call abort ()
+ stop
+ end
+ subroutine x
+ common // j
+ real a(n)
+ j = 1
+ return
+ entry y(a,n)
+ call foo(a(1))
+ end
+ subroutine foo(a)
+ common // j
+ real a
+ j = 2
+ return
+ end
+