mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 03:56:42 +00:00

As Fortran 2018 C819, a variable with the BIND attribute shall be declared in the specification part of a module. Add the support for this check. Reviewed By: klausler Differential Revision: https://reviews.llvm.org/D126653
35 lines
1.0 KiB
Fortran
35 lines
1.0 KiB
Fortran
! RUN: %python %S/test_errors.py %s %flang_fc1
|
|
|
|
module m
|
|
interface
|
|
module subroutine dump()
|
|
end subroutine
|
|
end interface
|
|
integer, bind(c, name="a") :: x1
|
|
integer, bind(c) :: x2
|
|
end
|
|
|
|
subroutine sub()
|
|
!ERROR: A variable with BIND(C) attribute may only appear in the specification part of a module
|
|
integer, bind(c, name="b") :: x3
|
|
!ERROR: A variable with BIND(C) attribute may only appear in the specification part of a module
|
|
integer, bind(c) :: x4
|
|
end
|
|
|
|
program main
|
|
!ERROR: A variable with BIND(C) attribute may only appear in the specification part of a module
|
|
integer, bind(c, name="c") :: x5
|
|
!ERROR: A variable with BIND(C) attribute may only appear in the specification part of a module
|
|
integer, bind(c) :: x6
|
|
end
|
|
|
|
submodule(m) m2
|
|
!ERROR: A variable with BIND(C) attribute may only appear in the specification part of a module
|
|
integer, bind(c, name="d") :: x7
|
|
!ERROR: A variable with BIND(C) attribute may only appear in the specification part of a module
|
|
integer, bind(c) :: x8
|
|
contains
|
|
module procedure dump
|
|
end procedure
|
|
end
|