| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! PR fortran/107426 |
| 4 |
! This example used to generate an ICE, caused by the use stmt from the nested |
| 5 |
! procedure declaration setting the result of the C_LOC global intrinsic symbol |
| 6 |
! to the symbol of C_PTR from ISO_C_BINDING being imported, before freeing the |
| 7 |
! latter symbol because of the rejection of the use statement. |
| 8 |
! |
| 9 |
! Contributed by Gerhard Steinmetz <[email protected]> |
| 10 |
|
| 11 |
module m |
| 12 |
contains |
| 13 |
subroutine p() bind(c) |
| 14 |
use, intrinsic :: iso_c_binding |
| 15 |
integer, target :: a = 1 |
| 16 |
type(c_ptr) :: z |
| 17 |
interface |
| 18 |
subroutine s(x) bind(cc) ! { dg-error "Missing closing paren" } |
| 19 |
use, intrinsic :: iso_c_binding ! { dg-error "Unexpected USE statement in INTERFACE block" } |
| 20 |
integer(c_int), value :: x ! { dg-error "Parameter 'c_int' at .1. has not been declared" } |
| 21 |
end ! { dg-error "END INTERFACE statement expected" } |
| 22 |
end interface |
| 23 |
z = c_loc(a) |
| 24 |
call s(z) |
| 25 |
end |
| 26 |
end |