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