xref: /llvm-project/flang/test/Semantics/bind-c11.f90 (revision 1c91d9bdea3b6c38e8fbce46ec8181a9c0aa26f8)
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
2module m
3  !ERROR: A scalar interoperable variable may not be ALLOCATABLE or POINTER
4  real, allocatable, bind(c) :: x1
5  !ERROR: A scalar interoperable variable may not be ALLOCATABLE or POINTER
6  real, pointer, bind(c) :: x2
7  !ERROR: BIND(C) array must have explicit shape or be assumed-size unless a dummy argument without the VALUE attribute
8  real, allocatable, bind(c) :: x3(:)
9 contains
10  subroutine s1(x) bind(c)
11    !PORTABILITY: A BIND(C) LOGICAL dummy argument should have the interoperable KIND=C_BOOL
12    logical(2), intent(in), value :: x
13  end
14  subroutine s2(x) bind(c)
15    !PORTABILITY: An interoperable procedure with an OPTIONAL dummy argument might not be portable
16    integer, intent(in), optional :: x
17  end
18  !ERROR: A subprogram interface with the BIND attribute may not have an alternate return argument
19  subroutine s3(*) bind(c)
20  end
21end
22