| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-sources "select-errors-c.c dump-descriptors.c" } |
| 3 |
! { dg-additional-options "-Wno-error -fcheck=all" } |
| 4 |
! { dg-warning "command-line option '-fcheck=all' is valid for Fortran but not for C" "" { target *-*-* } 0 } |
| 5 |
! |
| 6 |
! This program tests that the CFI_select_part function properly detects |
| 7 |
! invalid arguments. All the interesting things happen in the |
| 8 |
! corresponding C code. |
| 9 |
! |
| 10 |
! The situation here seems to be that while TS29113 defines error codes for |
| 11 |
! CFI_select_part, it doesn't actually require the implementation to detect |
| 12 |
! those errors by saying the arguments "shall be" such-and-such, e.g. it is |
| 13 |
! undefined behavior if they are not. In gfortran you can enable some |
| 14 |
! run-time checking by building with -fcheck=all. |
| 15 |
|
| 16 |
program testit |
| 17 |
use iso_c_binding |
| 18 |
implicit none |
| 19 |
|
| 20 |
interface |
| 21 |
subroutine ctest () bind (c) |
| 22 |
end subroutine |
| 23 |
end interface |
| 24 |
|
| 25 |
call ctest () |
| 26 |
|
| 27 |
end program |