libgomp/testsuite/libgomp.fortran/optional-bind-c.f90
raw| 1 | ! With bind(C), the C (CFI) array descriptor is converted to |
| 2 | ! a Fortran array descriptor - thus, internally a PARM_DECL is |
| 3 | ! converted to a VAR_DECL - check that the optional check still works |
| 4 | |
| 5 | module m |
| 6 | contains |
| 7 | subroutine foo(x, y) bind(C) |
| 8 | integer, optional :: x,y(:) |
| 9 | !$omp target map(tofrom:x) |
| 10 | if (present (x)) x = 5 |
| 11 | if (present (y)) y(1) = 5 |
| 12 | !$omp end target |
| 13 | end |
| 14 | end |
| 15 | |
| 16 | use m |
| 17 | call foo() |
| 18 | end |