* gfortran.fortran-torture/execute/contained_3.f90: New test.
authorPaul Brook <paul@codesourcery.com>
Sat, 12 Jun 2004 15:37:23 +0000 (15:37 +0000)
committerPaul Brook <pbrook@gcc.gnu.org>
Sat, 12 Jun 2004 15:37:23 +0000 (15:37 +0000)
From-SVN: r83033

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/execute/contained_3.f90 [new file with mode: 0644]

index 0e9b731a6238faeb8435c70ac7ec30f57d2b4c7f..9862dead242239ffaf379a2a8240e10618e4873f 100644 (file)
@@ -1,3 +1,7 @@
+2004-06-12  Paul Brook  <paul@codesourcery.com>
+
+       * gfortran.fortran-torture/execute/contained_3.f90: New test.
+
 2004-06-12  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR fortran/14923
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/contained_3.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/contained_3.f90
new file mode 100644 (file)
index 0000000..d0de1f4
--- /dev/null
@@ -0,0 +1,22 @@
+! Program to test contained functions calling their siblings.
+! This is tricky because we don't find the declaration for the sibling
+! function until after the caller has been parsed.
+program contained_3
+  call test
+contains
+  subroutine test
+    if (sub(3) .ne. 6) call abort
+  end subroutine
+  integer function sub(i)
+    integer i
+    if (i .gt. 1) then
+      sub = sub2(i) * i
+    else
+      sub = 1
+    end if
+  end function
+  integer function sub2(i)
+    integer i
+    sub2 = sub(i - 1)
+  end function
+end program