Tim Keith 99aa87a5b5 [flang][NFC] Simplify semantics test scripts
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
2020-05-11 11:49:25 -07:00

205 lines
2.8 KiB
Fortran

! RUN: %S/test_modfile.sh %s %t %f18
! Test that subprogram interfaces get all of the symbols that they need.
module m1
integer(8) :: i
type t1
sequence
integer :: j
end type
type t2
end type
end
!Expect: m1.mod
!module m1
! integer(8)::i
! type::t1
! sequence
! integer(4)::j
! end type
! type::t2
! end type
!end
module m2
integer(8) :: k
contains
subroutine s(a, j)
use m1
integer(8) :: j
real :: a(i:j,1:k) ! need i from m1
end
end
!Expect: m2.mod
!module m2
! integer(8)::k
!contains
! subroutine s(a,j)
! use m1,only:i
! integer(8)::j
! real(4)::a(i:j,1_8:k)
! end
!end
module m3
implicit none
contains
subroutine s(b, n)
type t2
end type
type t4(l)
integer, len :: l
type(t2) :: x ! need t2
end type
integer :: n
type(t4(n)) :: b
end
end module
!Expect: m3.mod
!module m3
!contains
! subroutine s(b,n)
! integer(4)::n
! type::t2
! end type
! type::t4(l)
! integer(4),len::l
! type(t2)::x
! end type
! type(t4(l=n))::b
! end
!end
module m4
contains
subroutine s1(a)
use m1
common /c/x,n ! x is needed
integer(8) :: n
real :: a(n)
type(t1) :: x
end
end
!Expect: m4.mod
!module m4
!contains
! subroutine s1(a)
! use m1,only:t1
! type(t1)::x
! common/c/x,n
! integer(8)::n
! real(4)::a(1_8:n)
! end
!end
module m5
type t5
end type
interface
subroutine s(x1,x5)
use m1
import :: t5
type(t1) :: x1
type(t5) :: x5
end subroutine
end interface
end
!Expect: m5.mod
!module m5
! type::t5
! end type
! interface
! subroutine s(x1,x5)
! use m1,only:t1
! import::t5
! type(t1)::x1
! type(t5)::x5
! end
! end interface
!end
module m6
contains
subroutine s(x)
use m1
type, extends(t2) :: t6
end type
type, extends(t6) :: t7
end type
type(t7) :: x
end
end
!Expect: m6.mod
!module m6
!contains
! subroutine s(x)
! use m1,only:t2
! type,extends(t2)::t6
! end type
! type,extends(t6)::t7
! end type
! type(t7)::x
! end
!end
module m7
type :: t5(l)
integer, len :: l
end type
contains
subroutine s1(x)
use m1
type(t5(i)) :: x
end subroutine
subroutine s2(x)
use m1
character(i) :: x
end subroutine
end
!Expect: m7.mod
!module m7
! type::t5(l)
! integer(4),len::l
! end type
!contains
! subroutine s1(x)
! use m1,only:i
! type(t5(l=int(i,kind=4)))::x
! end
! subroutine s2(x)
! use m1,only:i
! character(i,1)::x
! end
!end
module m8
use m1, only: t1, t2
interface
subroutine s1(x)
import
type(t1) :: x
end subroutine
subroutine s2(x)
import :: t2
type(t2) :: x
end subroutine
end interface
end
!Expect: m8.mod
!module m8
! use m1,only:t1
! use m1,only:t2
! interface
! subroutine s1(x)
! import::t1
! type(t1)::x
! end
! end interface
! interface
! subroutine s2(x)
! import::t2
! type(t2)::x
! end
! end interface
!end