| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-sources ISO_Fortran_binding_3.c } |
| 3 |
! |
| 4 |
! Test the fix for PR88929. |
| 5 |
! |
| 6 |
integer, dimension (:,:), allocatable :: actual |
| 7 |
integer, dimension(2,2) :: src = reshape ([1,2,3,4], [2,2]) |
| 8 |
|
| 9 |
allocate (actual, source = src) |
| 10 |
|
| 11 |
ier = test1 (actual) |
| 12 |
if (ier .ne. 0) stop 1 |
| 13 |
if (any (actual .ne. src + 1)) stop 2 |
| 14 |
|
| 15 |
contains |
| 16 |
|
| 17 |
function test1 (arg) RESULT(err) |
| 18 |
USE, INTRINSIC :: ISO_C_BINDING |
| 19 |
INTEGER(C_INT) :: err |
| 20 |
type(*), dimension(..), intent(inout) :: arg |
| 21 |
interface |
| 22 |
function test_c (a) BIND(C, NAME="c_test") RESULT(err) |
| 23 |
USE, INTRINSIC :: ISO_C_BINDING |
| 24 |
type(*), dimension(..), intent(inout) :: a |
| 25 |
INTEGER(C_INT) :: err |
| 26 |
end function |
| 27 |
end interface |
| 28 |
|
| 29 |
err = test_c (arg) ! This used to ICE |
| 30 |
|
| 31 |
end function test1 |
| 32 |
end |