llvm-project/flang/test/Semantics/resolve42.f90

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

115 lines
2.4 KiB
Fortran
Raw Normal View History

[flang] A rework of the cmake build components for in and out of tree builds. In general all the basic functionality seems to work and removes some redundancy and more complicated features in favor of borrowing infrastructure from LLVM build configurations. Here's a quick summary of details and remaining issues: * Testing has spanned Ubuntu 18.04 & 19.10, CentOS 7, RHEL 8, and MacOS/darwin. Architectures include x86_64 and Arm. Without access to Window nothing has been tested there yet. * As we change file and directory naming schemes (i.e., capitalization) some odd things can occur on MacOS systems with case preserving but not case senstive file system configurations. Can be painful and certainly something to watch out for as any any such changes continue. * Testing infrastructure still needs to be tuned up and worked on. Note that there do appear to be cases of some tests hanging (on MacOS in particular). They appear unrelated to the build process. * Shared library configurations need testing (and probably fixing). * Tested both standalone and 'in-mono repo' builds. Changes for supporting the mono repo builds will require LLVM-level changes that are straightforward when the time comes. * The configuration contains a work-around for LLVM's C++ standard mode passing down into Flang/F18 builds (i.e., LLVM CMake configuration would force a -std=c++11 flag to show up in command line arguments. The current configuration removes that automatically and is more strict in following new CMake guidelines for enforcing C++17 mode across all the CMake files. * Cleaned up a lot of repetition in the command line arguments. It is likely that more work is still needed to both allow for customization and working around CMake defailts (or those inherited from LLVM's configuration files). On some platforms agressive optimization flags (e.g. -O3) can actually break builds due to the inlining of templates in .cpp source files that then no longer are available for use cases outside those source files (shows up as link errors). Sticking at -O2 appears to fix this. Currently this CMake configuration forces this in release mode but at the cost of stomping on any CMake, or user customized, settings for the release flags. * Made the lit tests non-source directory dependent where appropriate. This is done by configuring certain test shell files to refer to the correct paths whether an in or out of tree build is being performed. These configured files are output in the build directory. A %B substitution is introduced in lit to refer to the build directory, mirroring the %S substitution for the source directory, so that the tests can refer to the configured shell scripts. Co-authored-by: David Truby <david.truby@arm.com> Original-commit: flang-compiler/f18@d1c7184159b2d3c542a8f36c58a0c817e7506845 Reviewed-on: https://github.com/flang-compiler/f18/pull/1045
2020-02-26 07:22:14 +08:00
! RUN: %B/test/Semantics/test_errors.sh %s %flang %t
subroutine s1
!ERROR: Array 'z' without ALLOCATABLE or POINTER attribute must have explicit shape
common x, y(4), z(:)
end
subroutine s2
common /c1/ x, y, z
!ERROR: 'y' is already in a COMMON block
common y
end
subroutine s3
procedure(real) :: x
!ERROR: 'x' is already declared as a procedure
common x
common y
!ERROR: 'y' is already declared as an object
procedure(real) :: y
end
subroutine s5
integer x(2)
!ERROR: The dimensions of 'x' have already been declared
common x(4), y(4)
!ERROR: The dimensions of 'y' have already been declared
real y(2)
end
function f6(x) result(r)
!ERROR: Dummy argument 'x' may not appear in a COMMON block
!ERROR: ALLOCATABLE object 'y' may not appear in a COMMON block
common x,y,z
allocatable y
!ERROR: Function result 'r' may not appear in a COMMON block
common r
end
module m7
!ERROR: Variable 'w' with BIND attribute may not appear in a COMMON block
!ERROR: Variable 'z' with BIND attribute may not appear in a COMMON block
common w,z
integer, bind(c) :: z
integer, bind(c,name="w") :: w
end
module m8
type t
end type
class(*), pointer :: x
!ERROR: Unlimited polymorphic pointer 'x' may not appear in a COMMON block
!ERROR: Unlimited polymorphic pointer 'y' may not appear in a COMMON block
common x, y
class(*), pointer :: y
end
module m9
integer x
end
subroutine s9
use m9
!ERROR: 'x' is use-associated from module 'm9' and cannot be re-declared
common x
end
module m10
type t
end type
type(t) :: x
!ERROR: Derived type 'x' in COMMON block must have the BIND or SEQUENCE attribute
common x
end
module m11
type t1
sequence
integer, allocatable :: a
end type
type t2
sequence
type(t1) :: b
integer:: c
end type
type(t2) :: x2
!ERROR: Derived type variable 'x2' may not appear in a COMMON block due to ALLOCATABLE component
common x2
end
module m12
type t1
sequence
integer :: a = 123
end type
type t2
sequence
type(t1) :: b
integer:: c
end type
type(t2) :: x2
!ERROR: Derived type variable 'x2' may not appear in a COMMON block due to component with default initialization
common x2
end
subroutine s13
block
!ERROR: COMMON statement is not allowed in a BLOCK construct
common x
end block
end
subroutine s14
!ERROR: 'c' appears as a COMMON block in a BIND statement but not in a COMMON statement
bind(c) :: /c/
end