| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! Correct an error in the eveluation of the CFI descriptor attribute for |
| 4 |
! the case where the bind_C formal argument is not an assumed shape array |
| 5 |
! and not allocatable or pointer. |
| 6 |
! |
| 7 |
! Contributed by Gilles Gouaillardet <[email protected]> |
| 8 |
! |
| 9 |
MODULE FOO |
| 10 |
INTERFACE |
| 11 |
SUBROUTINE dummy(buf) BIND(C, name="clock") |
| 12 |
type(*), dimension(..) :: buf |
| 13 |
END SUBROUTINE |
| 14 |
END INTERFACE |
| 15 |
END MODULE |
| 16 |
|
| 17 |
PROGRAM main |
| 18 |
USE FOO |
| 19 |
IMPLICIT NONE |
| 20 |
integer(8) :: before, after |
| 21 |
|
| 22 |
INTEGER, parameter :: n = 1 |
| 23 |
|
| 24 |
INTEGER, ALLOCATABLE :: buf(:) |
| 25 |
INTEGER :: buf2(n) |
| 26 |
INTEGER :: i |
| 27 |
|
| 28 |
ALLOCATE(buf(n)) |
| 29 |
before = LOC(buf(1)) |
| 30 |
CALL dummy (buf) |
| 31 |
after = LOC(buf(1)) |
| 32 |
|
| 33 |
if (before .NE. after) stop 1 |
| 34 |
|
| 35 |
before = LOC(buf2(1)) |
| 36 |
CALL dummy (buf) |
| 37 |
after = LOC(buf2(1)) |
| 38 |
|
| 39 |
if (before .NE. after) stop 2 |
| 40 |
|
| 41 |
END PROGRAM |