| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-fcheck=pointer" } |
| 3 |
! { dg-shouldfail "Argument not allocated" } |
| 4 |
! { dg-output "Fortran runtime error: Allocatable actual argument 'c_init2' is not allocated" } |
| 5 |
! |
| 6 |
! Tests fix for PR100136 |
| 7 |
! |
| 8 |
! Test cut down from PR58586 |
| 9 |
! |
| 10 |
|
| 11 |
module test_pr58586_mod |
| 12 |
implicit none |
| 13 |
|
| 14 |
type :: a |
| 15 |
end type |
| 16 |
|
| 17 |
type :: c |
| 18 |
type(a), allocatable :: a |
| 19 |
end type |
| 20 |
|
| 21 |
contains |
| 22 |
|
| 23 |
subroutine add_class_c (d) |
| 24 |
class(c), value :: d |
| 25 |
end subroutine |
| 26 |
|
| 27 |
class(c) function c_init2() |
| 28 |
allocatable :: c_init2 |
| 29 |
end function |
| 30 |
|
| 31 |
end module test_pr58586_mod |
| 32 |
|
| 33 |
program test_pr58586 |
| 34 |
use test_pr58586_mod |
| 35 |
|
| 36 |
! This needs to execute, to see whether the segfault at runtime is resolved |
| 37 |
call add_class_c(c_init2()) |
| 38 |
|
| 39 |
end program |