gcc/testsuite/gfortran.fortran-torture/execute/strret.f90
raw| 1 | ! Program to test caracter string return values |
| 2 | function test () |
| 3 | implicit none |
| 4 | character(len=10) :: test |
| 5 | test = "World" |
| 6 | end function |
| 7 | |
| 8 | function test2 () result (r) |
| 9 | implicit none |
| 10 | character(len=5) :: r |
| 11 | r = "Hello" |
| 12 | end function |
| 13 | |
| 14 | program strret |
| 15 | implicit none |
| 16 | character(len=15) :: s |
| 17 | character(len=10) :: test |
| 18 | character(len=5) :: test2 |
| 19 | |
| 20 | s = test () |
| 21 | if (s .ne. "World") STOP 1 |
| 22 | |
| 23 | s = "Hello " // test () |
| 24 | if (s .ne. test2 () //" World") STOP 2 |
| 25 | end |