| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-fdump-tree-original" } |
| 3 |
! |
| 4 |
! Test the fix for PR80850 in which the _len field was not being |
| 5 |
! set for 'arg' in the call to 'foo'. |
| 6 |
! |
| 7 |
type :: mytype |
| 8 |
integer :: i |
| 9 |
end type |
| 10 |
class (mytype), pointer :: c |
| 11 |
|
| 12 |
allocate (c, source = mytype (99_8)) |
| 13 |
|
| 14 |
call foo(c) |
| 15 |
call bar(c) |
| 16 |
|
| 17 |
deallocate (c) |
| 18 |
|
| 19 |
contains |
| 20 |
|
| 21 |
subroutine foo (arg) |
| 22 |
class(*) :: arg |
| 23 |
select type (arg) |
| 24 |
type is (mytype) |
| 25 |
if (arg%i .ne. 99_8) STOP 1 |
| 26 |
end select |
| 27 |
end subroutine |
| 28 |
|
| 29 |
subroutine bar (arg) |
| 30 |
class(mytype) :: arg |
| 31 |
select type (arg) |
| 32 |
type is (mytype) |
| 33 |
if (arg%i .ne. 99_8) STOP 2 |
| 34 |
end select |
| 35 |
end subroutine |
| 36 |
|
| 37 |
end |
| 38 |
! { dg-final { scan-tree-dump-times "arg.*._len" 1 "original" } } |