Debian Codegraph @

gcc/testsuite/gfortran.dg/bind_c_optional-1.f90

raw
1 ! { dg-do run }
2 !
3 ! PR fortran/92872
4 !
5 ! Contributed by G. Steinmetz
6 !
7 module m
8 contains
9 subroutine s(x) bind(c)
10 integer, allocatable, optional :: x(:)
11 x = [1, 2, 3]
12 end
13 end
14
15 use m
16 integer, allocatable :: y(:)
17 ! NOTE: starting at 0, otherwise it will fail due to PR 92189
18 allocate(y(0:2))
19 y = [9, 8, 7]
20 call s(y)
21 if (any (y /= [1, 2, 3])) stop 1
22 end