| 1 |
! Check that character valued statement functions honour length parameters |
| 2 |
program st_function_1 |
| 3 |
character(8) :: foo |
| 4 |
character(15) :: bar |
| 5 |
character(6) :: p |
| 6 |
character (7) :: s |
| 7 |
foo(p) = p // "World" |
| 8 |
bar(p) = p // "World" |
| 9 |
|
| 10 |
! Expression longer than function, actual arg shorter than dummy. |
| 11 |
call check (foo("Hello"), "Hello Wo") ! { dg-warning "Character length of actual argument shorter" } |
| 12 |
|
| 13 |
! Expression shorter than function, actual arg longer than dummy. |
| 14 |
! Result shorter than type |
| 15 |
s = "Hello" |
| 16 |
call check (bar(s), "Hello World ") |
| 17 |
contains |
| 18 |
subroutine check(a, b) |
| 19 |
character (len=*) :: a, b |
| 20 |
|
| 21 |
if ((a .ne. b) .or. (len(a) .ne. len(b))) STOP 1 |
| 22 |
end subroutine |
| 23 |
end program |