diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.fortran-torture/execute/entry_2.f90 | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gfortran.fortran-torture/execute/entry_2.f90')
-rw-r--r-- | gcc/testsuite/gfortran.fortran-torture/execute/entry_2.f90 | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/entry_2.f90 b/gcc/testsuite/gfortran.fortran-torture/execute/entry_2.f90 new file mode 100644 index 000000000..5db39db6a --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/execute/entry_2.f90 @@ -0,0 +1,51 @@ +! Test alternate entry points for functions when the result types +! of all entry points match + + character*(*) function f1 (str, i, j) + character str*(*), e1*(*), e2*(*) + integer i, j + f1 = str (i:j) + return + entry e1 (str, i, j) + i = i + 1 + entry e2 (str, i, j) + j = j - 1 + e2 = str (i:j) + end function + + character*5 function f3 () + character e3*(*), e4*(*) + integer i + f3 = 'ABCDE' + return + entry e3 (i) + entry e4 (i) + if (i .gt. 0) then + e3 = 'abcde' + else + e4 = 'UVWXY' + endif + end function + + program entrytest + character f1*16, e1*16, e2*16, str*16, ret*16 + character f3*5, e3*5, e4*5 + integer i, j + str = 'ABCDEFGHIJ' + i = 2 + j = 6 + ret = f1 (str, i, j) + if ((i .ne. 2) .or. (j .ne. 6)) call abort () + if (ret .ne. 'BCDEF') call abort () + ret = e1 (str, i, j) + if ((i .ne. 3) .or. (j .ne. 5)) call abort () + if (ret .ne. 'CDE') call abort () + ret = e2 (str, i, j) + if ((i .ne. 3) .or. (j .ne. 4)) call abort () + if (ret .ne. 'CD') call abort () + if (f3 () .ne. 'ABCDE') call abort () + if (e3 (1) .ne. 'abcde') call abort () + if (e4 (1) .ne. 'abcde') call abort () + if (e3 (0) .ne. 'UVWXY') call abort () + if (e4 (0) .ne. 'UVWXY') call abort () + end program |