| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-options "-fsanitize=undefined -fcheck=all" } |
| 3 |
|
| 4 |
! PR fortran/92621 |
| 5 |
|
| 6 |
subroutine hello(val) bind(c) |
| 7 |
use, intrinsic :: iso_c_binding, only: c_int |
| 8 |
|
| 9 |
implicit none |
| 10 |
|
| 11 |
integer(kind=c_int), allocatable, intent(out) :: val(:) |
| 12 |
|
| 13 |
allocate(val(1)) |
| 14 |
val = 2 |
| 15 |
return |
| 16 |
end subroutine hello |
| 17 |
|
| 18 |
program alloc_p |
| 19 |
|
| 20 |
use, intrinsic :: iso_c_binding, only: c_int |
| 21 |
|
| 22 |
implicit none |
| 23 |
|
| 24 |
interface |
| 25 |
subroutine hello(val) bind(c) |
| 26 |
import :: c_int |
| 27 |
implicit none |
| 28 |
integer(kind=c_int), allocatable, intent(out) :: val(:) |
| 29 |
end subroutine hello |
| 30 |
end interface |
| 31 |
|
| 32 |
integer(kind=c_int), allocatable :: a(:) |
| 33 |
|
| 34 |
allocate(a(1)) |
| 35 |
a = 1 |
| 36 |
call hello(a) |
| 37 |
stop |
| 38 |
|
| 39 |
end program alloc_p |