summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/interface_1.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/interface_1.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/interface_1.f9042
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/interface_1.f90 b/gcc/testsuite/gfortran.dg/interface_1.f90
new file mode 100644
index 000000000..e170f870e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/interface_1.f90
@@ -0,0 +1,42 @@
+! { dg-do compile }
+! This program would segfault without the patch for PR fortran/24005.
+module y
+ !
+ ! If private statement is removed, then we get a bunch of errors
+ !
+ private f
+ !
+ ! If we rename 'f' in module y to say 'g', then gfortran correctly
+ ! identifies ambiguous as being ambiguous.
+ !
+ interface ambiguous
+ module procedure f
+ end interface
+
+ contains
+
+ real function f(a)
+ real a
+ f = a
+ end function
+
+end module y
+
+module z
+
+ use y
+
+ interface ambiguous
+ module procedure f ! { dg-warning "in generic interface" "" }
+ end interface
+
+ contains
+
+ real function f(a)
+ real a
+ f = a
+ end function
+
+end module z
+
+! { dg-final { cleanup-modules "y z" } }