Files
clang-p2996/flang/test/Semantics/bind-c11.f90
Peter Klausler 1c91d9bdea [flang] Ensure that portability warnings are conditional (#71857)
Before emitting a warning message, code should check that the usage in
question should be diagnosed by calling ShouldWarn(). A fair number of
sites in the code do not, and can emit portability warnings
unconditionally, which can confuse a user that hasn't asked for them
(-pedantic) and isn't terribly concerned about portability *to* other
compilers.

Add calls to ShouldWarn() or IsEnabled() around messages that need them,
and add -pedantic to tests that now require it to test their portability
messages, and add more expected message lines to those tests when
-pedantic causes other diagnostics to fire.
2023-11-13 16:13:50 -08:00

22 lines
924 B
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
module m
!ERROR: A scalar interoperable variable may not be ALLOCATABLE or POINTER
real, allocatable, bind(c) :: x1
!ERROR: A scalar interoperable variable may not be ALLOCATABLE or POINTER
real, pointer, bind(c) :: x2
!ERROR: BIND(C) array must have explicit shape or be assumed-size unless a dummy argument without the VALUE attribute
real, allocatable, bind(c) :: x3(:)
contains
subroutine s1(x) bind(c)
!PORTABILITY: A BIND(C) LOGICAL dummy argument should have the interoperable KIND=C_BOOL
logical(2), intent(in), value :: x
end
subroutine s2(x) bind(c)
!PORTABILITY: An interoperable procedure with an OPTIONAL dummy argument might not be portable
integer, intent(in), optional :: x
end
!ERROR: A subprogram interface with the BIND attribute may not have an alternate return argument
subroutine s3(*) bind(c)
end
end