| 1 |
! Program to test the LEN intrinsic |
| 2 |
program test |
| 3 |
character(len=10) a |
| 4 |
character(len=8) w |
| 5 |
type person |
| 6 |
character(len=10) name |
| 7 |
integer age |
| 8 |
end type person |
| 9 |
type(person) Tom |
| 10 |
integer n |
| 11 |
a = w (n) |
| 12 |
|
| 13 |
if ((a .ne. "01234567") .or. (n .ne. 8)) STOP 1 |
| 14 |
if (len(Tom%name) .ne. 10) STOP 2 |
| 15 |
call array_test() |
| 16 |
end |
| 17 |
|
| 18 |
function w(i) |
| 19 |
character(len=8) w |
| 20 |
integer i |
| 21 |
w = "01234567" |
| 22 |
i = len(w) |
| 23 |
end |
| 24 |
|
| 25 |
! This is the testcase from PR 15211 converted to a subroutine |
| 26 |
subroutine array_test |
| 27 |
implicit none |
| 28 |
character(len=10) a(4) |
| 29 |
if (len(a) .NE. 10) STOP 1 |
| 30 |
end subroutine array_test |
| 31 |
|