There were several different ways of handling the option to f18 to find predefined modules: - test_errors.sh was created by cmake substituting FLANG_INTRINSIC_MODULES_DIR into test_errors.sh.in - some tests used the flang script which has the option built it - some tests used %f18_with_includes which was replaced by the path to f18 plus the -I option - some included -I../../include/flang in their run command To make this more consistent, change %f18 to include the -intrinsic-module-directory option and use it everywhere, including to replace %flang and %f18_with_includes. This requires changing all of the invocations of the test scripts to put %f18 at the end so that it can expand to more than one argument. This eliminates the need to generate test_errors.sh which means we don't need flang/test/Semantics/CMakeLists.txt or the %B substitution. That makes the test_errors.sh command like the others, replacing %B/test/Semantics/test_errors.sh with %S/test_errors.sh. Also remove the OPTIONS: functionality as custom options can be included in the RUN: command. And remove -I/../../include/flang as that is now always included. Differential Revision: https://reviews.llvm.org/D79634
88 lines
1.6 KiB
Fortran
88 lines
1.6 KiB
Fortran
! RUN: %S/test_errors.sh %s %t %f18
|
|
module m1
|
|
implicit none
|
|
contains
|
|
subroutine foo(x)
|
|
real :: x
|
|
end subroutine
|
|
end module
|
|
|
|
!Note: PGI, Intel, GNU, and NAG allow this; Sun does not
|
|
module m2
|
|
use m1
|
|
implicit none
|
|
!ERROR: 'foo' may not be the name of both a generic interface and a procedure unless it is a specific procedure of the generic
|
|
interface foo
|
|
module procedure s
|
|
end interface
|
|
contains
|
|
subroutine s(i)
|
|
integer :: i
|
|
end subroutine
|
|
end module
|
|
|
|
subroutine foo
|
|
!ERROR: Cannot use-associate 'foo'; it is already declared in this scope
|
|
use m1
|
|
end
|
|
|
|
subroutine bar
|
|
!ERROR: Cannot use-associate 'bar'; it is already declared in this scope
|
|
use m1, bar => foo
|
|
end
|
|
|
|
!OK to use-associate a type with the same name as a generic
|
|
module m3a
|
|
type :: foo
|
|
end type
|
|
end
|
|
module m3b
|
|
use m3a
|
|
interface foo
|
|
end interface
|
|
end
|
|
|
|
! Can't have derived type and function with same name
|
|
module m4a
|
|
type :: foo
|
|
end type
|
|
contains
|
|
!ERROR: 'foo' is already declared in this scoping unit
|
|
function foo(x)
|
|
end
|
|
end
|
|
! Even if there is also a generic interface of that name
|
|
module m4b
|
|
type :: foo
|
|
end type
|
|
!ERROR: 'foo' is already declared in this scoping unit
|
|
interface foo
|
|
procedure :: foo
|
|
end interface foo
|
|
contains
|
|
function foo(x)
|
|
end
|
|
end
|
|
|
|
! Use associating a name that is a generic and a derived type
|
|
module m5a
|
|
interface g
|
|
end interface
|
|
type g
|
|
end type
|
|
end module
|
|
module m5b
|
|
use m5a
|
|
interface g
|
|
procedure f
|
|
end interface
|
|
type(g) :: x
|
|
contains
|
|
function f(i)
|
|
end function
|
|
end module
|
|
subroutine s5
|
|
use m5b
|
|
type(g) :: y
|
|
end
|