| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! Test the fix for PR84869, where line 19 segfaulted. |
| 4 |
! |
| 5 |
! Contributed by Gerhard Steinmetz <[email protected]> |
| 6 |
! |
| 7 |
program p |
| 8 |
type t |
| 9 |
integer :: i |
| 10 |
end type |
| 11 |
call s |
| 12 |
contains |
| 13 |
function f() |
| 14 |
class(t), allocatable :: f(:) |
| 15 |
f = [(t(i), i = 1, 10)] |
| 16 |
end |
| 17 |
subroutine s |
| 18 |
class(*), allocatable :: z(:) |
| 19 |
allocate (z, source = f ()) ! Segfault in gfc_class_len_get. |
| 20 |
select type (z) |
| 21 |
type is (t) |
| 22 |
if (any (z%i /= [(i, i = 1,10)])) stop 1 |
| 23 |
end select |
| 24 |
end |
| 25 |
end |