| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-std=f2018" } |
| 3 |
! PR fortran/95879 |
| 4 |
! Contributed by G. Steinmetz <[email protected]> |
| 5 |
! |
| 6 |
! Use-after-free in gfc_resolve_formal_arglist when a contained subroutine |
| 7 |
! has a statement function whose dummy argument name matches a symbol |
| 8 |
! replaced by gfc_fixup_sibling_symbols. |
| 9 |
|
| 10 |
module m1 |
| 11 |
contains |
| 12 |
integer function f(x) bind(c) |
| 13 |
use iso_c_binding |
| 14 |
contains |
| 15 |
subroutine s |
| 16 |
c_funloc(f) = x ! { dg-warning "Obsolescent feature: Statement function" } |
| 17 |
end |
| 18 |
end |
| 19 |
end |
| 20 |
|
| 21 |
module m2 |
| 22 |
contains |
| 23 |
integer function f(x) |
| 24 |
use iso_c_binding |
| 25 |
contains |
| 26 |
subroutine s |
| 27 |
c_funloc(f) = x ! { dg-warning "Obsolescent feature: Statement function" } |
| 28 |
end |
| 29 |
end |
| 30 |
end |