| 1 |
! { dg-do compile } |
| 2 |
! Tests the fix for PR36526, in which the call to getStrLen would |
| 3 |
! generate an error due to the use of a wrong symbol in interface.c |
| 4 |
! |
| 5 |
! Contributed by Bálint Aradi <[email protected]> |
| 6 |
! |
| 7 |
module TestPure |
| 8 |
implicit none |
| 9 |
|
| 10 |
type T1 |
| 11 |
character(10) :: str |
| 12 |
end type T1 |
| 13 |
|
| 14 |
contains |
| 15 |
|
| 16 |
pure function getT1Len(self) result(t1len) |
| 17 |
type(T1), pointer :: self |
| 18 |
integer :: t1len |
| 19 |
|
| 20 |
t1len = getStrLen(self%str) |
| 21 |
|
| 22 |
end function getT1Len |
| 23 |
|
| 24 |
|
| 25 |
pure function getStrLen(str) result(length) |
| 26 |
character(*), intent(in) :: str |
| 27 |
integer :: length |
| 28 |
|
| 29 |
length = len_trim(str) |
| 30 |
|
| 31 |
end function getStrLen |
| 32 |
|
| 33 |
end module TestPure |
| 34 |
|
| 35 |
|
| 36 |
program Test |
| 37 |
use TestPure |
| 38 |
implicit none |
| 39 |
|
| 40 |
type(T1), pointer :: pT1 |
| 41 |
|
| 42 |
allocate(pT1) |
| 43 |
pT1%str = "test" |
| 44 |
write (*,*) getT1Len(pT1) |
| 45 |
deallocate(pT1) |
| 46 |
|
| 47 |
end program Test |