From 6c16aa4f67f7938d6bc0ced36d192f5d7f8a3dab Mon Sep 17 00:00:00 2001 From: Patrick McCormick Date: Tue, 25 Feb 2020 16:22:14 -0700 Subject: [PATCH] [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 Original-commit: flang-compiler/f18@d1c7184159b2d3c542a8f36c58a0c817e7506845 Reviewed-on: https://github.com/flang-compiler/f18/pull/1045 --- flang/.gitignore | 2 + flang/CMakeLists.txt | 466 +++++++++++++----- flang/README.md | 25 - flang/cmake/modules/AddFlang.cmake | 141 ++++++ flang/cmake/modules/CMakeLists.txt | 74 +++ flang/cmake/modules/FlangConfig.cmake.in | 13 + flang/include/CMakeLists.txt | 1 + flang/include/flang/Version.inc.in | 5 + flang/lib/CMakeLists.txt | 8 - flang/lib/Common/CMakeLists.txt | 9 +- flang/lib/Decimal/CMakeLists.txt | 9 +- flang/lib/Evaluate/CMakeLists.txt | 9 +- flang/lib/Parser/CMakeLists.txt | 9 +- flang/lib/Semantics/CMakeLists.txt | 9 +- flang/test/CMakeLists.txt | 16 +- flang/test/Semantics/CMakeLists.txt | 1 + flang/test/Semantics/allocate01.f90 | 2 +- flang/test/Semantics/allocate02.f90 | 2 +- flang/test/Semantics/allocate03.f90 | 2 +- flang/test/Semantics/allocate04.f90 | 2 +- flang/test/Semantics/allocate05.f90 | 2 +- flang/test/Semantics/allocate06.f90 | 2 +- flang/test/Semantics/allocate07.f90 | 2 +- flang/test/Semantics/allocate08.f90 | 2 +- flang/test/Semantics/allocate09.f90 | 2 +- flang/test/Semantics/allocate10.f90 | 2 +- flang/test/Semantics/allocate11.f90 | 2 +- flang/test/Semantics/allocate12.f90 | 2 +- flang/test/Semantics/allocate13.f90 | 2 +- flang/test/Semantics/altreturn01.f90 | 2 +- flang/test/Semantics/altreturn02.f90 | 2 +- flang/test/Semantics/altreturn03.f90 | 2 +- flang/test/Semantics/altreturn04.f90 | 2 +- flang/test/Semantics/altreturn05.f90 | 2 +- flang/test/Semantics/assign01.f90 | 2 +- flang/test/Semantics/assign02.f90 | 2 +- flang/test/Semantics/assign03.f90 | 2 +- flang/test/Semantics/assign04.f90 | 2 +- flang/test/Semantics/bad-forward-type.f90 | 2 +- flang/test/Semantics/bindings01.f90 | 2 +- flang/test/Semantics/block-data01.f90 | 2 +- flang/test/Semantics/blockconstruct01.f90 | 2 +- flang/test/Semantics/blockconstruct02.f90 | 2 +- flang/test/Semantics/blockconstruct03.f90 | 2 +- flang/test/Semantics/c_f_pointer.f90 | 2 +- flang/test/Semantics/call01.f90 | 2 +- flang/test/Semantics/call02.f90 | 2 +- flang/test/Semantics/call03.f90 | 2 +- flang/test/Semantics/call04.f90 | 2 +- flang/test/Semantics/call05.f90 | 2 +- flang/test/Semantics/call06.f90 | 2 +- flang/test/Semantics/call07.f90 | 2 +- flang/test/Semantics/call08.f90 | 2 +- flang/test/Semantics/call09.f90 | 2 +- flang/test/Semantics/call10.f90 | 2 +- flang/test/Semantics/call11.f90 | 2 +- flang/test/Semantics/call12.f90 | 2 +- flang/test/Semantics/call13.f90 | 2 +- flang/test/Semantics/call14.f90 | 2 +- flang/test/Semantics/call15.f90 | 2 +- flang/test/Semantics/canondo16.f90 | 4 +- flang/test/Semantics/coarrays01.f90 | 2 +- flang/test/Semantics/complex01.f90 | 2 +- flang/test/Semantics/computed-goto01.f90 | 2 +- flang/test/Semantics/computed-goto02.f90 | 2 +- flang/test/Semantics/critical01.f90 | 2 +- flang/test/Semantics/critical02.f90 | 2 +- flang/test/Semantics/critical03.f90 | 2 +- flang/test/Semantics/data01.f90 | 2 +- flang/test/Semantics/data02.f90 | 2 +- flang/test/Semantics/deallocate01.f90 | 2 +- flang/test/Semantics/deallocate04.f90 | 2 +- flang/test/Semantics/deallocate05.f90 | 2 +- flang/test/Semantics/doconcurrent01.f90 | 2 +- flang/test/Semantics/doconcurrent05.f90 | 2 +- flang/test/Semantics/doconcurrent06.f90 | 2 +- flang/test/Semantics/doconcurrent08.f90 | 2 +- flang/test/Semantics/dosemantics01.f90 | 2 +- flang/test/Semantics/dosemantics02.f90 | 2 +- flang/test/Semantics/dosemantics03.f90 | 2 +- flang/test/Semantics/dosemantics04.f90 | 2 +- flang/test/Semantics/dosemantics05.f90 | 2 +- flang/test/Semantics/dosemantics06.f90 | 2 +- flang/test/Semantics/dosemantics07.f90 | 2 +- flang/test/Semantics/dosemantics08.f90 | 2 +- flang/test/Semantics/dosemantics09.f90 | 2 +- flang/test/Semantics/dosemantics10.f90 | 2 +- flang/test/Semantics/dosemantics11.f90 | 2 +- flang/test/Semantics/dosemantics12.f90 | 2 +- flang/test/Semantics/entry01.f90 | 2 +- flang/test/Semantics/equivalence01.f90 | 2 +- flang/test/Semantics/expr-errors01.f90 | 2 +- flang/test/Semantics/expr-errors02.f90 | 2 +- flang/test/Semantics/forall01.f90 | 2 +- flang/test/Semantics/if_arith01.f90 | 2 +- flang/test/Semantics/if_arith02.f90 | 2 +- flang/test/Semantics/if_arith03.f90 | 2 +- flang/test/Semantics/if_arith04.f90 | 2 +- flang/test/Semantics/if_construct01.f90 | 2 +- flang/test/Semantics/if_construct02.f90 | 2 +- flang/test/Semantics/if_stmt01.f90 | 2 +- flang/test/Semantics/if_stmt02.f90 | 2 +- flang/test/Semantics/if_stmt03.f90 | 2 +- flang/test/Semantics/implicit01.f90 | 2 +- flang/test/Semantics/implicit02.f90 | 2 +- flang/test/Semantics/implicit03.f90 | 2 +- flang/test/Semantics/implicit04.f90 | 2 +- flang/test/Semantics/implicit05.f90 | 2 +- flang/test/Semantics/implicit06.f90 | 2 +- flang/test/Semantics/implicit07.f90 | 2 +- flang/test/Semantics/implicit08.f90 | 2 +- flang/test/Semantics/init01.f90 | 2 +- flang/test/Semantics/int-literals.f90 | 2 +- flang/test/Semantics/io01.f90 | 2 +- flang/test/Semantics/io02.f90 | 2 +- flang/test/Semantics/io03.f90 | 2 +- flang/test/Semantics/io04.f90 | 2 +- flang/test/Semantics/io05.f90 | 2 +- flang/test/Semantics/io06.f90 | 2 +- flang/test/Semantics/io07.f90 | 2 +- flang/test/Semantics/io08.f90 | 2 +- flang/test/Semantics/io09.f90 | 2 +- flang/test/Semantics/io10.f90 | 2 +- flang/test/Semantics/kinds02.f90 | 2 +- flang/test/Semantics/kinds04.f90 | 2 +- flang/test/Semantics/misc-declarations.f90 | 2 +- flang/test/Semantics/namelist01.f90 | 2 +- flang/test/Semantics/null01.f90 | 2 +- flang/test/Semantics/nullify01.f90 | 2 +- flang/test/Semantics/nullify02.f90 | 2 +- flang/test/Semantics/omp-atomic.f90 | 2 +- .../test/Semantics/omp-clause-validity01.f90 | 2 +- .../Semantics/omp-declarative-directive.f90 | 2 +- .../test/Semantics/omp-device-constructs.f90 | 2 +- flang/test/Semantics/omp-loop-association.f90 | 2 +- flang/test/Semantics/omp-nested01.f90 | 2 +- flang/test/Semantics/omp-resolve01.f90 | 2 +- flang/test/Semantics/omp-resolve02.f90 | 2 +- flang/test/Semantics/omp-resolve03.f90 | 2 +- flang/test/Semantics/omp-resolve04.f90 | 2 +- flang/test/Semantics/omp-resolve05.f90 | 2 +- flang/test/Semantics/resolve01.f90 | 2 +- flang/test/Semantics/resolve02.f90 | 2 +- flang/test/Semantics/resolve03.f90 | 2 +- flang/test/Semantics/resolve04.f90 | 2 +- flang/test/Semantics/resolve05.f90 | 2 +- flang/test/Semantics/resolve06.f90 | 2 +- flang/test/Semantics/resolve07.f90 | 2 +- flang/test/Semantics/resolve08.f90 | 2 +- flang/test/Semantics/resolve09.f90 | 2 +- flang/test/Semantics/resolve10.f90 | 2 +- flang/test/Semantics/resolve11.f90 | 2 +- flang/test/Semantics/resolve12.f90 | 2 +- flang/test/Semantics/resolve13.f90 | 2 +- flang/test/Semantics/resolve14.f90 | 2 +- flang/test/Semantics/resolve15.f90 | 2 +- flang/test/Semantics/resolve16.f90 | 2 +- flang/test/Semantics/resolve17.f90 | 2 +- flang/test/Semantics/resolve18.f90 | 2 +- flang/test/Semantics/resolve19.f90 | 2 +- flang/test/Semantics/resolve20.f90 | 2 +- flang/test/Semantics/resolve21.f90 | 2 +- flang/test/Semantics/resolve22.f90 | 2 +- flang/test/Semantics/resolve23.f90 | 2 +- flang/test/Semantics/resolve24.f90 | 2 +- flang/test/Semantics/resolve25.f90 | 2 +- flang/test/Semantics/resolve26.f90 | 2 +- flang/test/Semantics/resolve27.f90 | 2 +- flang/test/Semantics/resolve28.f90 | 2 +- flang/test/Semantics/resolve29.f90 | 2 +- flang/test/Semantics/resolve30.f90 | 2 +- flang/test/Semantics/resolve31.f90 | 2 +- flang/test/Semantics/resolve32.f90 | 2 +- flang/test/Semantics/resolve33.f90 | 2 +- flang/test/Semantics/resolve34.f90 | 2 +- flang/test/Semantics/resolve35.f90 | 2 +- flang/test/Semantics/resolve36.f90 | 3 +- flang/test/Semantics/resolve37.f90 | 2 +- flang/test/Semantics/resolve38.f90 | 2 +- flang/test/Semantics/resolve39.f90 | 2 +- flang/test/Semantics/resolve40.f90 | 2 +- flang/test/Semantics/resolve41.f90 | 2 +- flang/test/Semantics/resolve42.f90 | 2 +- flang/test/Semantics/resolve43.f90 | 2 +- flang/test/Semantics/resolve44.f90 | 2 +- flang/test/Semantics/resolve45.f90 | 2 +- flang/test/Semantics/resolve46.f90 | 2 +- flang/test/Semantics/resolve47.f90 | 2 +- flang/test/Semantics/resolve48.f90 | 2 +- flang/test/Semantics/resolve49.f90 | 2 +- flang/test/Semantics/resolve50.f90 | 2 +- flang/test/Semantics/resolve51.f90 | 2 +- flang/test/Semantics/resolve52.f90 | 2 +- flang/test/Semantics/resolve53.f90 | 2 +- flang/test/Semantics/resolve54.f90 | 2 +- flang/test/Semantics/resolve55.f90 | 2 +- flang/test/Semantics/resolve56.f90 | 2 +- flang/test/Semantics/resolve57.f90 | 2 +- flang/test/Semantics/resolve58.f90 | 2 +- flang/test/Semantics/resolve59.f90 | 2 +- flang/test/Semantics/resolve60.f90 | 2 +- flang/test/Semantics/resolve61.f90 | 2 +- flang/test/Semantics/resolve62.f90 | 2 +- flang/test/Semantics/resolve63.f90 | 2 +- flang/test/Semantics/resolve64.f90 | 2 +- flang/test/Semantics/resolve65.f90 | 2 +- flang/test/Semantics/resolve66.f90 | 2 +- flang/test/Semantics/resolve67.f90 | 2 +- flang/test/Semantics/resolve68.f90 | 2 +- flang/test/Semantics/resolve69.f90 | 2 +- flang/test/Semantics/resolve70.f90 | 2 +- flang/test/Semantics/resolve71.f90 | 2 +- flang/test/Semantics/resolve72.f90 | 2 +- flang/test/Semantics/resolve73.f90 | 2 +- flang/test/Semantics/resolve74.f90 | 2 +- flang/test/Semantics/resolve75.f90 | 2 +- flang/test/Semantics/resolve76.f90 | 2 +- flang/test/Semantics/resolve77.f90 | 2 +- flang/test/Semantics/resolve78.f90 | 2 +- flang/test/Semantics/resolve79.f90 | 2 +- flang/test/Semantics/resolve80.f90 | 2 +- flang/test/Semantics/resolve81.f90 | 2 +- flang/test/Semantics/resolve82.f90 | 2 +- flang/test/Semantics/resolve83.f90 | 2 +- flang/test/Semantics/resolve84.f90 | 2 +- flang/test/Semantics/resolve85.f90 | 2 +- flang/test/Semantics/separate-mp01.f90 | 2 +- flang/test/Semantics/separate-mp02.f90 | 2 +- flang/test/Semantics/stop01.f90 | 2 +- flang/test/Semantics/structconst01.f90 | 2 +- flang/test/Semantics/structconst02.f90 | 2 +- flang/test/Semantics/structconst03.f90 | 2 +- flang/test/Semantics/structconst04.f90 | 2 +- flang/test/Semantics/test_any.sh | 4 +- .../{test_errors.sh => test_errors.sh.in} | 4 +- flang/test/lit.cfg.py | 4 +- flang/tools/CMakeLists.txt | 1 + flang/tools/f18-parse-demo/CMakeLists.txt | 13 + .../f18-parse-demo.cpp | 0 .../{f18 => f18-parse-demo}/stub-evaluate.cpp | 0 flang/tools/f18/CMakeLists.txt | 62 +-- flang/tools/f18/{flang.sh => flang.sh.in} | 2 +- flang/unittests/CMakeLists.txt | 8 - flang/unittests/Decimal/CMakeLists.txt | 11 +- flang/unittests/Evaluate/CMakeLists.txt | 9 +- flang/unittests/Runtime/CMakeLists.txt | 19 +- 246 files changed, 866 insertions(+), 505 deletions(-) create mode 100644 flang/cmake/modules/AddFlang.cmake create mode 100644 flang/cmake/modules/CMakeLists.txt create mode 100644 flang/cmake/modules/FlangConfig.cmake.in create mode 100644 flang/include/CMakeLists.txt create mode 100644 flang/include/flang/Version.inc.in create mode 100644 flang/test/Semantics/CMakeLists.txt rename flang/test/Semantics/{test_errors.sh => test_errors.sh.in} (93%) create mode 100644 flang/tools/f18-parse-demo/CMakeLists.txt rename flang/tools/{f18 => f18-parse-demo}/f18-parse-demo.cpp (100%) rename flang/tools/{f18 => f18-parse-demo}/stub-evaluate.cpp (100%) rename flang/tools/f18/{flang.sh => flang.sh.in} (95%) diff --git a/flang/.gitignore b/flang/.gitignore index c45f199bbfe0..4da4ee1178ba 100644 --- a/flang/.gitignore +++ b/flang/.gitignore @@ -17,3 +17,5 @@ CMakeCache.txt */*/Makefile cmake_install.cmake formatted +.DS_Store +.vs_code diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt index 8883fb7e7597..54c5d52c45f6 100644 --- a/flang/CMakeLists.txt +++ b/flang/CMakeLists.txt @@ -1,97 +1,140 @@ -#===-- CMakeLists.txt ------------------------------------------------------===# -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===------------------------------------------------------------------------===# - cmake_minimum_required(VERSION 3.9.0) +# RPATH settings on macOS do not affect INSTALL_NAME. +if (POLICY CMP0068) + cmake_policy(SET CMP0068 NEW) + set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) +endif() + +# Include file check macros honor CMAKE_REQUIRED_LIBRARIES. +if(POLICY CMP0075) + cmake_policy(SET CMP0075 NEW) +endif() + +# option() honors normal variables. +if (POLICY CMP0077) + cmake_policy(SET CMP0077 NEW) +endif() + option(LINK_WITH_FIR "Link driver with FIR and LLVM" ON) -# Pass -DGCC=... to cmake to use a specific gcc installation. -if( GCC ) - set(CMAKE_CXX_COMPILER "${GCC}/bin/g++") - set(CMAKE_CC_COMPILER "${GCC}/bin/gcc") - set(CMAKE_BUILD_RPATH "${GCC}/lib64") - set(CMAKE_INSTALL_RPATH "${GCC}/lib64") +# Flang requires C++17. +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +set(CMAKE_CXX_EXTENSIONS OFF) + +set(FLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + +if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE) + message(FATAL_ERROR "In-source builds are not allowed. \ + Please create a directory and run cmake from there,\ + passing the path to this source directory as the last argument.\ + This process created the file `CMakeCache.txt' and the directory\ + `CMakeFiles'. Please delete them.") endif() -if(BUILD_WITH_CLANG) - file(TO_CMAKE_PATH "${BUILD_WITH_CLANG}" CLANG_PATH) - set(CMAKE_CXX_COMPILER "${CLANG_PATH}/bin/clang++") - set(CMAKE_CC_COMPILER "${CLANG_PATH}/bin/clang") - if(GCC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --gcc-toolchain=${GCC}") + +# Add Flang-centric modules to cmake path. +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") +include(AddFlang) + +# Check for a standalone build and configure as appropriate from +# there. +if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) +message("Building Flang as a standalone project.") +project(Flang) + + set(FLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) + if (NOT MSVC_IDE) + set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS} + CACHE BOOL "Enable assertions") + # Assertions follow llvm's configuration. + mark_as_advanced(LLVM_ENABLE_ASSERTIONS) + endif() + + # We need a pre-built/installed version of LLVM. + find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_PATH}") + list(APPEND CMAKE_MODULE_PATH ${LLVM_DIR}) + + # If LLVM links to zlib we need the imported targets so we can too. + if(LLVM_ENABLE_ZLIB) + find_package(ZLIB REQUIRED) + endif() + + include(CMakeParseArguments) + include(AddLLVM) + include(HandleLLVMOptions) + include(VersionFromVCS) + + if(LINK_WITH_FIR) + include(TableGen) + include(AddMLIR) + find_program(MLIR_TABLEGEN_EXE "mlir-tblgen" ${LLVM_TOOLS_BINARY_DIR} + NO_DEFAULT_PATH) + endif() + + option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON) + option(LLVM_INSTALL_TOOLCHAIN_ONLY + "Only include toolchain files in the 'install' target." OFF) + option(LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN + "Set to ON to force using an old, unsupported host toolchain." OFF) + + + # Add LLVM include files as if they were SYSTEM because there are complex unused + # parameter issues that may or may not appear depending on the environments and + # compilers (ifdefs are involved). This allows warnings from LLVM headers to be + # ignored while keeping -Wunused-parameter a fatal error inside f18 code base. + # This may have to be fine-tuned if flang headers are consider part of this + # LLVM_INCLUDE_DIRS when merging in the monorepo (Warning from flang headers + # should not be suppressed). + include_directories(SYSTEM ${LLVM_INCLUDE_DIRS}) + add_definitions(${LLVM_DEFINITIONS}) + + # LLVM's cmake configuration files currently sneak in a c++11 flag. + # We look for it here and remove it from Flang's compile flags to + # avoid some mixed compilation flangs (e.g. -std=c++11 ... -std=c++17). + if (DEFINED LLVM_CXX_STD) + message("LLVM configuration set a C++ standard: ${LLVM_CXX_STD}") + if (NOT LLVM_CXX_STD EQUAL "c++17") + message("Flang: Overriding LLVM's 'cxx_std' setting...") + message(" removing '-std=${LLVM_CXX_STD}'") + message(" CMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'") + string(REPLACE " -std=${LLVM_CXX_STD}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + message(" [NEW] CMAKE_CXX_FLAGS='${CMAKE_CXX_FLAGS}'") + endif() + endif() + + link_directories("${LLVM_LIBRARY_DIR}") + + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY + ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY + ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}) + + set(BACKEND_PACKAGE_STRING "LLVM ${LLVM_PACKAGE_VERSION}") + set(LLVM_EXTERNAL_LIT "${LLVM_TOOLS_BINARY_DIR}/llvm-lit" CACHE STRING "Command used to spawn lit") + + option(FLANG_INCLUDE_TESTS + "Generate build targets for the Flang unit tests." + ON) + add_custom_target(check-all DEPENDS check-flang) +else() + option(FLANG_INCLUDE_TESTS + "Generate build targets for the Flang unit tests." + ${LLVM_INCLUDE_TESTS}) + set(FLANG_BINARY_DIR ${CMAKE_BINARY_DIR}/tools/flang) + set(BACKEND_PACKAGE_STRING "${PACKAGE_STRING}") + if (LINK_WITH_FIR) + set(MLIR_MAIN_SRC_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include ) # --src-root + set(MLIR_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include ) # --includedir + set(MLIR_TABLEGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/tools/mlir/include) + set(MLIR_TABLEGEN_EXE $) + include_directories(SYSTEM ${MLIR_INCLUDE_DIR}) + include_directories(SYSTEM ${MLIR_TABLEGEN_OUTPUT_DIR}) endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-command-line-argument") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstring-conversion") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcovered-switch-default") endif() -# Set RPATH in every executable, overriding the default setting. -# If you set this first variable back to true (the default), -# also set the second one. -set(CMAKE_SKIP_BUILD_RPATH false) -set(CMAKE_BUILD_WITH_INSTALL_RPATH false) - -set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" "${CMAKE_INSTALL_RPATH}") - -# Reminder: Setting CMAKE_CXX_COMPILER must be done before calling project() - -project(f18 CXX) - -if( NOT CMAKE_BUILD_TYPE ) - set( CMAKE_BUILD_TYPE Debug ) -endif() - -message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}" ) - -find_package(LLVM REQUIRED CONFIG) -message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION} in ${LLVM_DIR}") -# If LLVM links to zlib we need the imported targets so we can too. -if(LLVM_ENABLE_ZLIB) - find_package(ZLIB REQUIRED) -endif() - -list(APPEND CMAKE_MODULE_PATH ${LLVM_DIR}) - -include(AddLLVM) - -# Get names for the LLVM libraries -# -# The full list of LLVM components can be obtained with -# -# llvm-config --components -# -# Similarly, the (static) libraries corresponding to some -# components (default is 'all') can be obtained with -# -# llvm-config --libs --link-static [component ...] -# -# See also -# http://llvm.org/docs/CMake.html#embedding-llvm-in-your-project -# https://stackoverflow.com/questions/41924375/llvm-how-to-specify-all-link-libraries-as-input-to-llvm-map-components-to-libna -# https://stackoverflow.com/questions/33948633/how-do-i-link-when-building-with-llvm-libraries - -# Add LLVM include files as if they were SYSTEM because there are complex unused -# parameter issues that may or may not appear depending on the environments and -# compilers (ifdefs are involved). This allows warnings from LLVM headers to be -# ignored while keeping -Wunused-parameter a fatal error inside f18 code base. -# This may have to be fine-tuned if flang headers are consider part of this -# LLVM_INCLUDE_DIRS when merging in the monorepo (Warning from flang headers -# should not be suppressed). -include_directories(SYSTEM ${LLVM_INCLUDE_DIRS}) -add_definitions(${LLVM_DEFINITIONS}) - -# LLVM_LIT_EXTERNAL store in cache so it could be used by AddLLVM.cmake -set(LLVM_EXTERNAL_LIT ${LLVM_TOOLS_BINARY_DIR}/llvm-lit CACHE STRING "Command used to spawn lit") - if(LINK_WITH_FIR) - include(TableGen) - include(AddMLIR) - find_program(MLIR_TABLEGEN_EXE "mlir-tblgen" ${LLVM_TOOLS_BINARY_DIR} - NO_DEFAULT_PATH) # tco tool and FIR lib output directories set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/bin) set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/lib) @@ -102,62 +145,227 @@ if(LINK_WITH_FIR) message(STATUS "LLVM libraries: ${LLVM_COMMON_LIBS}") endif() -if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - if(BUILD_WITH_CLANG_LIBRARIES) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdinc++ -I${BUILD_WITH_CLANG_LIBRARIES}/include/c++/v1 -DCLANG_LIBRARIES") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -Wl,-rpath,${BUILD_WITH_CLANG_LIBRARIES}/lib -L${BUILD_WITH_CLANG_LIBRARIES}/lib") - else() - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++") - endif() - if(GCC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --gcc-toolchain=${GCC}") - endif() - endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-qual") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wimplicit-fallthrough") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wdelete-non-virtual-dtor") - set(CMAKE_CXX_FLAGS_RELEASE "-O2") - set(CMAKE_CXX_FLAGS_MINSIZEREL "-O2 '-DCHECK=(void)'") - set(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUGF18") +# Add Flang-centric modules to cmake path. +include_directories(BEFORE + ${FLANG_BINARY_DIR}/include + ${FLANG_SOURCE_DIR}/include) - # Building shared libraries is death on performance with GCC by default - # due to the need to preserve the right to override external entry points - # at dynamic link time. -fno-semantic-interposition waives that right and - # recovers a little bit of that performance. - if (BUILD_SHARED_LIBS AND NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-semantic-interposition") - endif() +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") + +if (NOT DEFAULT_SYSROOT) + set(DEFAULT_SYSROOT "" CACHE PATH + "The to use for the system root for all compiler invocations (--sysroot=).") endif() +if (NOT ENABLE_LINKER_BUILD_ID) + set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld") +endif() + +set(FLANG_DEFAULT_LINKER "" CACHE STRING + "Default linker to use (linker name or absolute path, empty for platform default)") + +set(FLANG_DEFAULT_RTLIB "" CACHE STRING + "Default Fortran runtime library to use (\"libFortranRuntime\"), leave empty for platform default.") + +if (NOT(FLANG_DEFAULT_RTLIB STREQUAL "")) + message(WARNING "Resetting Flang's default runtime library to use platform default.") + set(FLANG_DEFAULT_RTLIB "" CACHE STRING + "Default runtime library to use (empty for platform default)" FORCE) +endif() + + + +set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}") +# Override LLVM versioning for now... set(FLANG_VERSION_MAJOR "0") set(FLANG_VERSION_MINOR "1") set(FLANG_VERSION_PATCHLEVEL "0") + + +if (NOT DEFINED FLANG_VERSION_MAJOR) + set(FLANG_VERSION_MAJOR ${LLVM_VERSION_MAJOR}) +endif() + +if (NOT DEFINED FLANG_VERSION_MINOR) + set(FLANG_VERSION_MINOR ${LLVM_VERSION_MINOR}) +endif() + +if (NOT DEFINED FLANG_VERSION_PATCHLEVEL) + set(FLANG_VERSION_PATCHLEVEL ${LLVM_VERSION_PATCH}) +endif() + +# Unlike PACKAGE_VERSION, FLANG_VERSION does not include LLVM_VERSION_SUFFIX. set(FLANG_VERSION "${FLANG_VERSION_MAJOR}.${FLANG_VERSION_MINOR}.${FLANG_VERSION_PATCHLEVEL}") -message(STATUS "FLANG version: ${FLANG_VERSION}") +message(STATUS "Flang version: ${FLANG_VERSION}") +# Flang executable version information +set(FLANG_EXECUTABLE_VERSION + "${FLANG_VERSION_MAJOR}" CACHE STRING + "Major version number to appended to the flang executable name.") +set(LIBFLANG_LIBRARY_VERSION + "${FLANG_VERSION_MAJOR}" CACHE STRING + "Major version number to appended to the libflang library.") -set(FLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -set(FLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) -set(FLANG_TOOLS_DIR ${FLANG_BINARY_DIR}/tools/f18/bin) +mark_as_advanced(FLANG_EXECUTABLE_VERSION LIBFLANG_LIBRARY_VERSION) -include_directories(BEFORE - ${FLANG_BINARY_DIR}/include - ${FLANG_SOURCE_DIR}/include - ) +set(FLANG_VENDOR ${PACKAGE_VENDOR} CACHE STRING + "Vendor-specific Flang version information.") +set(FLANG_VENDOR_UTI "org.llvm.flang" CACHE STRING + "Vendor-specific uti.") -enable_testing() +if (FLANG_VENDOR) + add_definitions(-DFLANG_VENDOR="${FLANG_VENDOR} ") +endif() -add_subdirectory(include/flang) -add_subdirectory(lib) -add_subdirectory(runtime) -add_subdirectory(unittests) -add_subdirectory(tools) -add_subdirectory(test) +set(FLANG_REPOSITORY_STRING "" CACHE STRING + "Vendor-specific text for showing the repository the source is taken from.") +if (FLANG_REPOSITORY_STRING) + add_definitions(-DFLANG_REPOSITORY_STRING="${FLANG_REPOSITORY_STRING}") +endif() +# Configure Flang's Version.inc file. +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/include/flang/Version.inc.in + ${CMAKE_CURRENT_BINARY_DIR}/include/flang/Version.inc) +# Configure Flang's version info header file. configure_file( ${FLANG_SOURCE_DIR}/include/flang/Config/config.h.cmake ${FLANG_BINARY_DIR}/include/flang/Config/config.h) + +# Add global F18 flags. +set(CMAKE_CXX_FLAGS "-fno-rtti -fno-exceptions -pedantic -Wall -Wextra -Werror -Wcast-qual -Wimplicit-fallthrough -Wdelete-non-virtual-dtor ${CMAKE_CXX_FLAGS}") + +# Builtin check_cxx_compiler_flag doesn't seem to work correctly +macro(check_compiler_flag flag resultVar) + unset(${resultVar} CACHE) + check_cxx_compiler_flag("${flag}" ${resultVar}) +endmacro() + +check_compiler_flag("-Werror -Wno-deprecated-copy" CXX_SUPPORTS_NO_DEPRECATED_COPY_FLAG) +if (CXX_SUPPORTS_NO_DEPRECATED_COPY_FLAG) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-copy") +endif() +check_compiler_flag("-Wstring-conversion" CXX_SUPPORTS_NO_STRING_CONVERSION_FLAG) +if (CXX_SUPPORTS_NO_STRING_CONVERSION_FLAG) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-string-conversion") +endif() + +# Add appropriate flags for GCC +if (LLVM_COMPILER_IS_GCC_COMPATIBLE) + + if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing -fno-semantic-interposition") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-command-line-argument -Wstring-conversion \ + -Wcovered-switch-default") + endif() # Clang. + + check_cxx_compiler_flag("-Werror -Wnested-anon-types" CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG) + if (CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types") + endif() + + # Add to or adjust build type flags. + # + # TODO: This needs some extra thought. CMake's default for release builds + # is -O3, which can cause build failures on certain platforms (and compilers) + # with the current code base -- some templated functions are inlined and don't + # become available at link time when using -O3 (with Clang under MacOS/darwin). + # If we reset CMake's default flags we also clobber any user provided settings; + # make it difficult to customize a build in this regard... The setup below + # has this side effect but enables successful builds across multiple platforms + # in release mode... + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUGF18") + set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DCHECK=\"(void)\"") # do we need -O2 here? + set(CMAKE_CXX_FLAGS_RELEASE "-O2") + + # Building shared libraries is bad for performance with GCC by default + # due to the need to preserve the right to override external entry points + if (BUILD_SHARED_LIBS AND NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-semantic-interposition") + endif() + +endif() + +list(REMOVE_DUPLICATES CMAKE_CXX_FLAGS) + +# Determine HOST_LINK_VERSION on Darwin. +set(HOST_LINK_VERSION) +if (APPLE) + set(LD_V_OUTPUT) + execute_process( + COMMAND sh -c "${CMAKE_LINKER} -v 2>&1 | head -1" + RESULT_VARIABLE HAD_ERROR + OUTPUT_VARIABLE LD_V_OUTPUT) + if (NOT HAD_ERROR) + if ("${LD_V_OUTPUT}" MATCHES ".*ld64-([0-9.]+).*") + string(REGEX REPLACE ".*ld64-([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT}) + elseif ("${LD_V_OUTPUT}" MATCHES "[^0-9]*([0-9.]+).*") + string(REGEX REPLACE "[^0-9]*([0-9.]+).*" "\\1" HOST_LINK_VERSION ${LD_V_OUTPUT}) + endif() + else() + message(FATAL_ERROR "${CMAKE_LINKER} failed with status ${HAD_ERROR}") + endif() +endif() + +include(CMakeParseArguments) +include(AddFlang) + + +add_subdirectory(include) +add_subdirectory(lib) +add_subdirectory(cmake/modules) + +option(FLANG_BUILD_TOOLS + "Build the Flang tools. If OFF, just generate build targets." ON) +if (FLANG_BUILD_TOOLS) + add_subdirectory(tools) +endif() +add_subdirectory(runtime) + +if (FLANG_INCLUDE_TESTS) + enable_testing() + add_subdirectory(test) + add_subdirectory(unittests) +endif() + +# TODO: Add doxygen support. +#option(FLANG_INCLUDE_DOCS "Generate build targets for the Flang docs." +# ${LLVM_INCLUDE_DOCS}) +#if (FLANG_INCLUDE_DOCS) +# add_subdirectory(documentation) +#endif() + +# Custom target to install Flang libraries. +add_custom_target(flang-libraries) +set_target_properties(flang-libraries PROPERTIES FOLDER "Misc") + +if (NOT LLVM_ENABLE_IDE) + add_llvm_install_targets(install-flang-libraries + DEPENDS flang-libraries + COMPONENT flang-libraries) +endif() + +get_property(FLANG_LIBS GLOBAL PROPERTY FLANG_LIBS) +if (FLANG_LIBS) + list(REMOVE_DUPLICATES FLANG_LIBS) + foreach(lib ${FLANG_LIBS}) + add_dependencies(flang-libraries ${lib}) + if (NOT LLVM_ENABLE_IDE) + add_dependencies(install-flang-libraries install-${lib}) + endif() + endforeach() +endif() + +if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) + install(DIRECTORY include/flang + DESTINATION include + COMPONENT flang-headers + FILES_MATCHING + PATTERN "*.def" + PATTERN "*.h" + PATTERN "*.inc" + PATTERN "*.td" + PATTERN "config.h" EXCLUDE + PATTERN ".git" EXCLUDE + PATTERN "CMakeFiles" EXCLUDE) +endif() diff --git a/flang/README.md b/flang/README.md index d8e2cbdef63b..926abc0ecf5d 100644 --- a/flang/README.md +++ b/flang/README.md @@ -150,15 +150,6 @@ or ``` CXX=/opt/gcc-7.2/bin/g++-7.2 cmake ... ``` -There's a third option! -The CMakeList.txt file uses the variable GCC -as the path to the bin directory containing the C++ compiler. - -GCC can be defined on the cmake command line -where `` is the path to a GCC installation with bin, lib, etc: -``` -cmake -DGCC= ... -``` ### Building f18 with clang @@ -166,27 +157,11 @@ To build f18 with clang, cmake needs to know how to find clang++ and the GCC library and tools that were used to build clang++. -The CMakeList.txt file expects either CXX or BUILD_WITH_CLANG to be set. - CXX should include the full path to clang++ or clang++ should be found on your PATH. ``` export CXX=clang++ ``` -BUILD_WITH_CLANG can be defined on the cmake command line -where `` -is the path to a clang installation with bin, lib, etc: -``` -cmake -DBUILD_WITH_CLANG= -``` -Or GCC can be defined on the f18 cmake command line -where `` is the path to a GCC installation with bin, lib, etc: -``` -cmake -DGCC= ... -``` -To use f18 after it is built, -the environment variables PATH and LD_LIBRARY_PATH -must be set to use GCC and its associated libraries. ### Installation Directory diff --git a/flang/cmake/modules/AddFlang.cmake b/flang/cmake/modules/AddFlang.cmake new file mode 100644 index 000000000000..84610a633a04 --- /dev/null +++ b/flang/cmake/modules/AddFlang.cmake @@ -0,0 +1,141 @@ +macro(set_flang_windows_version_resource_properties name) + if (DEFINED windows_resource_file) + set_windows_version_resource_properties(${name} ${windows_resource_file} + VERSION_MAJOR ${FLANG_VERSION_MAJOR} + VERSION_MINOR ${FLANG_VERSION_MINOR} + VERSION_PATCHLEVEL ${FLANG_VERSION_PATCHLEVEL} + VERSION_STRING "${FLANG_VERSION} (${BACKEND_PACKAGE_STRING})" + PRODUCT_NAME "flang") + endif() +endmacro() + +macro(add_flang_subdirectory name) + add_llvm_subdirectory(FLANG TOOL ${name}) +endmacro() + +macro(add_flang_library name) + cmake_parse_arguments(ARG + "SHARED" + "" + "ADDITIONAL_HEADERS" + ${ARGN}) + set(srcs) + if (MSVC_IDE OR XCODE) + # Add public headers + file(RELATIVE_PATH lib_path + ${FLANG_SOURCE_DIR}/lib/ + ${CMAKE_CURRENT_SOURCE_DIR}) + if(NOT lib_path MATCHES "^[.][.]") + file( GLOB_RECURSE headers + ${FLANG_SOURCE_DIR}/include/flang/${lib_path}/*.h + ${FLANG_SOURCE_DIR}/include/flang/${lib_path}/*.def) + set_source_files_properties(${headers} PROPERTIES HEADER_FILE_ONLY ON) + + if (headers) + set(srcs ${headers}) + endif() + endif() + endif(MSVC_IDE OR XCODE) + + if (srcs OR ARG_ADDITIONAL_HEADERS) + set(srcs + ADDITIONAL_HEADERS + ${srcs} + ${ARG_ADDITIONAL_HEADERS}) # It may contain unparsed unknown args. + + endif() + + if (ARG_SHARED) + set(LIBTYPE SHARED) + else() + # llvm_add_library ignores BUILD_SHARED_LIBS if STATIC is explicitly set, + # so we need to handle it here. + if (BUILD_SHARED_LIBS) + set(LIBTYPE SHARED OBJECT) + else() + set(LIBTYPE STATIC OBJECT) + endif() + set_property(GLOBAL APPEND PROPERTY FLANG_STATIC_LIBS ${name}) + endif() + + llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs}) + + if (TARGET ${name}) + target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS}) + + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "libflang") + set(export_to_flangtargets) + if (${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR + "flang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR + NOT LLVM_DISTRIBUTION_COMPONENTS) + set(export_to_flangtargets EXPORT FlangTargets) + set_property(GLOBAL PROPERTY FLANG_HAS_EXPORTS True) + endif() + + install(TARGETS ${name} + COMPONENT ${name} + ${export_to_flangtargets} + LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} + ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} + RUNTIME DESTINATION bin) + + if (NOT LLVM_ENABLE_IDE) + add_llvm_install_targets(install-${name} + DEPENDS ${name} + COMPONENT ${name}) + endif() + + set_property(GLOBAL APPEND PROPERTY FLANG_LIBS ${name}) + endif() + set_property(GLOBAL APPEND PROPERTY FLANG_EXPORTS ${name}) + else() + # Add empty "phony" target + add_custom_target(${name}) + endif() + + set_target_properties(${name} PROPERTIES FOLDER "Flang libraries") + set_flang_windows_version_resource_properties(${name}) +endmacro(add_flang_library) + +macro(add_flang_executable name) + add_llvm_executable(${name} ${ARGN}) + set_target_properties(${name} PROPERTIES FOLDER "Flang executables") + set_flang_windows_version_resource_properties(${name}) +endmacro(add_flang_executable) + +macro(add_flang_tool name) + if (NOT FLANG_BUILD_TOOLS) + set(EXCLUDE_FROM_ALL ON) + endif() + + add_flang_executable(${name} ${ARGN}) + add_dependencies(${name} flang-resource-headers) + + if (FLANG_BUILD_TOOLS) + set(export_to_flangtargets) + if (${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR + NOT LLVM_DISTRIBUTION_COMPONENTS) + set(export_to_flangtargets EXPORT FlangTargets) + set_property(GLOBAL PROPERTY FLANG_HAS_EXPORTS True) + endif() + + install(TARGETS ${name} + ${export_to_flangtargets} + RUNTIME DESTINATION bin + COMPONENT ${name}) + + if(NOT LLVM_ENABLE_IDE) + add_llvm_install_targets(install-${name} + DEPENDS ${name} + COMPONENT ${name}) + endif() + set_property(GLOBAL APPEND PROPERTY FLANG_EXPORTS ${name}) + endif() +endmacro() + +macro(add_flang_symlink name dest) + add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE) + # Always generate install targets + llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE) +endmacro() + diff --git a/flang/cmake/modules/CMakeLists.txt b/flang/cmake/modules/CMakeLists.txt new file mode 100644 index 000000000000..4822124ca412 --- /dev/null +++ b/flang/cmake/modules/CMakeLists.txt @@ -0,0 +1,74 @@ +# Generate a list of CMake library targets so that other CMake projects can +# link against them. LLVM calls its version of this file LLVMExports.cmake, but +# the usual CMake convention seems to be ${Project}Targets.cmake. +set(FLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/flang) +set(flang_cmake_builddir "${CMAKE_BINARY_DIR}/${FLANG_INSTALL_PACKAGE_DIR}") + +# Keep this in sync with llvm/cmake/CMakeLists.txt! +set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) +set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") + +get_property(FLANG_EXPORTS GLOBAL PROPERTY FLANG_EXPORTS) +export(TARGETS ${FLANG_EXPORTS} FILE ${flang_cmake_builddir}/FlangTargets.cmake) + +# Generate FlangConfig.cmake for the build tree. +set(FLANG_CONFIG_CMAKE_DIR "${flang_cmake_builddir}") +set(FLANG_CONFIG_LLVM_CMAKE_DIR "${llvm_cmake_builddir}") +set(FLANG_CONFIG_EXPORTS_FILE "${flang_cmake_builddir}/FlangTargets.cmake") +set(FLANG_CONFIG_INCLUDE_DIRS + "${FLANG_SOURCE_DIR}/include" + "${FLANG_BINARY_DIR}/include" + ) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfig.cmake.in + ${flang_cmake_builddir}/FlangConfig.cmake + @ONLY) +set(FLANG_CONFIG_CMAKE_DIR) +set(FLANG_CONFIG_LLVM_CMAKE_DIR) +set(FLANG_CONFIG_EXPORTS_FILE) + +# Generate FlangConfig.cmake for the install tree. +set(FLANG_CONFIG_CODE " + # Compute the installation prefix from this LLVMConfig.cmake file location. + get_filename_component(FLANG_INSTALL_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)") +# Construct the proper number of get_filename_component(... PATH) +# calls to compute the installation prefix. +string(REGEX REPLACE "/" ";" _count "${FLANG_INSTALL_PACKAGE_DIR}") +foreach(p ${_count}) + set(FLANG_CONFIG_CODE "${FLANG_CONFIG_CODE} + get_filename_component(FLANG_INSTALL_PREFIX \"\${FLANG_INSTALL_PREFIX}\" PATH)") +endforeach(p) + +set(FLANG_CONFIG_CMAKE_DIR "\${FLANG_INSTALL_PREFIX}/${FLANG_INSTALL_PACKAGE_DIR}") +set(FLANG_CONFIG_LLVM_CMAKE_DIR "\${FLANG_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}") +set(FLANG_CONFIG_EXPORTS_FILE "\${FLANG_CMAKE_DIR}/FlangTargets.cmake") +set(FLANG_CONFIG_INCLUDE_DIRS "\${FLANG_INSTALL_PREFIX}/include") + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/FlangConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FlangConfig.cmake + @ONLY) + +set(FLANG_CONFIG_CODE) +set(FLANG_CONFIG_CMAKE_DIR) +set(FLANG_CONFIG_EXPORTS_FILE) + +if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) + get_property(flang_has_exports GLOBAL PROPERTY FLANG_HAS_EXPORTS) + if(flang_has_exports) + install(EXPORT FlangTargets DESTINATION ${FLANG_INSTALL_PACKAGE_DIR} + COMPONENT flang-cmake-exports) + endif() + + install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FlangConfig.cmake + DESTINATION ${FLANG_INSTALL_PACKAGE_DIR} + COMPONENT flang-cmake-exports) + + if(NOT LLVM_ENABLE_IDE) + # Add a dummy target so this can be used with LLVM_DISTRIBUTION_COMPONENTS + add_custom_target(flang-cmake-exports) + add_llvm_install_targets(install-flang-cmake-exports + COMPONENT flang-cmake-exports) + endif() +endif() diff --git a/flang/cmake/modules/FlangConfig.cmake.in b/flang/cmake/modules/FlangConfig.cmake.in new file mode 100644 index 000000000000..3540e2df3406 --- /dev/null +++ b/flang/cmake/modules/FlangConfig.cmake.in @@ -0,0 +1,13 @@ +# This file allows users to call find_package(Flang) and pick up our targets. + +@FLANG_CONFIG_CODE@ + +find_package(LLVM REQUIRED CONFIG + HINTS "@FLANG_CONFIG_LLVM_CMAKE_DIR@") + +set(FLANG_EXPORTED_TARGETS "@FLANG_EXPORTS@") +set(FLANG_CMAKE_DIR "FLANG_CONFIG_CMAKE_DIR@") +set(FLANG_INCLUDE_DIRS "@FLANG_CONFIG_INCLUDE_DIRS@") + +# Provide all our library targets to users. +include("@FLANG_CONFIG_EXPORTS_FILE@") diff --git a/flang/include/CMakeLists.txt b/flang/include/CMakeLists.txt new file mode 100644 index 000000000000..e6bb9db72ff6 --- /dev/null +++ b/flang/include/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(flang) diff --git a/flang/include/flang/Version.inc.in b/flang/include/flang/Version.inc.in new file mode 100644 index 000000000000..a0eeab2686a9 --- /dev/null +++ b/flang/include/flang/Version.inc.in @@ -0,0 +1,5 @@ +#define FLANG_VERSION @FLANG_VERSION@ +#define FLANG_VERSION_STRING "@FLANG_VERSION@" +#define FLANG_VERSION_MAJOR @FLANG_VERSION_MAJOR@ +#define FLANG_VERSION_MINOR @FLANG_VERSION_MINOR@ +#define FLANG_VERSION_PATCHLEVEL @FLANG_VERSION_PATCHLEVEL@ diff --git a/flang/lib/CMakeLists.txt b/flang/lib/CMakeLists.txt index f2fe30dca5a1..ae321b872a76 100644 --- a/flang/lib/CMakeLists.txt +++ b/flang/lib/CMakeLists.txt @@ -1,11 +1,3 @@ -#===-- lib/CMakeLists.txt --------------------------------------------------===# -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===------------------------------------------------------------------------===# - add_subdirectory(Common) add_subdirectory(Evaluate) add_subdirectory(Decimal) diff --git a/flang/lib/Common/CMakeLists.txt b/flang/lib/Common/CMakeLists.txt index acbe9d125b99..f1be58f0e6d0 100644 --- a/flang/lib/Common/CMakeLists.txt +++ b/flang/lib/Common/CMakeLists.txt @@ -1,10 +1,3 @@ -#===-- lib/Common/CMakeLists.txt -------------------------------------------===# -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===------------------------------------------------------------------------===# add_library(FortranCommon Fortran.cpp @@ -13,6 +6,8 @@ add_library(FortranCommon idioms.cpp ) +target_compile_features(FortranCommon PUBLIC cxx_std_17) + install (TARGETS FortranCommon ARCHIVE DESTINATION lib LIBRARY DESTINATION lib diff --git a/flang/lib/Decimal/CMakeLists.txt b/flang/lib/Decimal/CMakeLists.txt index 54542187aea4..92f87621fc05 100644 --- a/flang/lib/Decimal/CMakeLists.txt +++ b/flang/lib/Decimal/CMakeLists.txt @@ -1,16 +1,11 @@ -#===-- lib/Decimal/CMakeLists.txt ------------------------------------------===# -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===------------------------------------------------------------------------===# add_library(FortranDecimal binary-to-decimal.cpp decimal-to-binary.cpp ) +target_compile_features(FortranDecimal PUBLIC cxx_std_17) + install (TARGETS FortranDecimal ARCHIVE DESTINATION lib LIBRARY DESTINATION lib diff --git a/flang/lib/Evaluate/CMakeLists.txt b/flang/lib/Evaluate/CMakeLists.txt index a3391dc40394..2b23455165aa 100644 --- a/flang/lib/Evaluate/CMakeLists.txt +++ b/flang/lib/Evaluate/CMakeLists.txt @@ -1,10 +1,3 @@ -#===-- lib/Evaluate/CMakeLists.txt -----------------------------------------===# -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===------------------------------------------------------------------------===# add_library(FortranEvaluate call.cpp @@ -34,6 +27,8 @@ add_library(FortranEvaluate variable.cpp ) +target_compile_features(FortranEvaluate PUBLIC cxx_std_17) + target_link_libraries(FortranEvaluate FortranCommon FortranDecimal diff --git a/flang/lib/Parser/CMakeLists.txt b/flang/lib/Parser/CMakeLists.txt index a04f37c71aec..9dc6480a2e9d 100644 --- a/flang/lib/Parser/CMakeLists.txt +++ b/flang/lib/Parser/CMakeLists.txt @@ -1,10 +1,3 @@ -#===-- lib/Parser/CMakeLists.txt -------------------------------------------===# -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===------------------------------------------------------------------------===# add_library(FortranParser Fortran-parsers.cpp @@ -32,6 +25,8 @@ add_library(FortranParser user-state.cpp ) +target_compile_features(FortranParser PRIVATE cxx_std_17) + target_link_libraries(FortranParser FortranCommon LLVMSupport diff --git a/flang/lib/Semantics/CMakeLists.txt b/flang/lib/Semantics/CMakeLists.txt index cbe9fc9b6b30..1ca03d05341f 100644 --- a/flang/lib/Semantics/CMakeLists.txt +++ b/flang/lib/Semantics/CMakeLists.txt @@ -1,10 +1,3 @@ -#===-- lib/Semantics/CMakeLists.txt ----------------------------------------===# -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===------------------------------------------------------------------------===# add_library(FortranSemantics assignment.cpp @@ -43,6 +36,8 @@ add_library(FortranSemantics unparse-with-symbols.cpp ) +target_compile_features(FortranSemantics PUBLIC cxx_std_17) + target_link_libraries(FortranSemantics FortranCommon FortranEvaluate diff --git a/flang/test/CMakeLists.txt b/flang/test/CMakeLists.txt index cdc5dd58d3ca..3e22d9f18c82 100644 --- a/flang/test/CMakeLists.txt +++ b/flang/test/CMakeLists.txt @@ -1,7 +1,9 @@ # Test runner infrastructure for Flang. This configures the Flang test trees # for use by Lit, and delegates to LLVM's lit test handlers. -set(FLANG_INTRINSIC_MODULES_DIR ${FLANG_BINARY_DIR}/tools/f18/include) +set(FLANG_INTRINSIC_MODULES_DIR ${FLANG_BINARY_DIR}/include/flang) + +set(FLANG_TOOLS_DIR ${FLANG_BINARY_DIR}/bin) configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in @@ -10,6 +12,8 @@ configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py ) +add_subdirectory(Semantics) + set(FLANG_TEST_PARAMS flang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py) @@ -21,10 +25,16 @@ if (LINK_WITH_FIR) list(APPEND FLANG_TEST_DEPENDS tco) endif() -add_lit_testsuite(check-all "Running the Flang regression tests" +add_custom_target(flang-test-depends DEPENDS ${FLANG_TEST_DEPENDS}) + +add_lit_testsuite(check-flang "Running the Flang regression tests" ${CMAKE_CURRENT_BINARY_DIR} PARAMS ${FLANG_TEST_PARAMS} DEPENDS ${FLANG_TEST_DEPENDS} ) -set_target_properties(check-all PROPERTIES FOLDER "Tests") +set_target_properties(check-flang PROPERTIES FOLDER "Tests") + +add_lit_testsuites(FLANG ${CMAKE_CURRENT_SOURCE_DIR} + PARAMS ${FLANG_TEST_PARAMS} + DEPENDS ${FLANG_TEST_DEPENDS}) diff --git a/flang/test/Semantics/CMakeLists.txt b/flang/test/Semantics/CMakeLists.txt new file mode 100644 index 000000000000..bdc81bbbe18c --- /dev/null +++ b/flang/test/Semantics/CMakeLists.txt @@ -0,0 +1 @@ +configure_file(test_errors.sh.in ${FLANG_BINARY_DIR}/test/Semantics/test_errors.sh @ONLY) diff --git a/flang/test/Semantics/allocate01.f90 b/flang/test/Semantics/allocate01.f90 index 0948230a3ea2..4907a9d9e21f 100644 --- a/flang/test/Semantics/allocate01.f90 +++ b/flang/test/Semantics/allocate01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements ! Creating a symbol that allocate should accept diff --git a/flang/test/Semantics/allocate02.f90 b/flang/test/Semantics/allocate02.f90 index 13a68e811a55..16895ef35001 100644 --- a/flang/test/Semantics/allocate02.f90 +++ b/flang/test/Semantics/allocate02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements diff --git a/flang/test/Semantics/allocate03.f90 b/flang/test/Semantics/allocate03.f90 index 63598f0786df..21b093ddefe9 100644 --- a/flang/test/Semantics/allocate03.f90 +++ b/flang/test/Semantics/allocate03.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements subroutine C933_a(b1, ca3, ca4, cp3, cp3mold, cp4, cp7, cp8, bsrc) diff --git a/flang/test/Semantics/allocate04.f90 b/flang/test/Semantics/allocate04.f90 index 40e7562938df..9371fcb2b1af 100644 --- a/flang/test/Semantics/allocate04.f90 +++ b/flang/test/Semantics/allocate04.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements diff --git a/flang/test/Semantics/allocate05.f90 b/flang/test/Semantics/allocate05.f90 index 84814b674735..e69ed9e5399f 100644 --- a/flang/test/Semantics/allocate05.f90 +++ b/flang/test/Semantics/allocate05.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements diff --git a/flang/test/Semantics/allocate06.f90 b/flang/test/Semantics/allocate06.f90 index 1de258ccfb46..ae9f4f60d318 100644 --- a/flang/test/Semantics/allocate06.f90 +++ b/flang/test/Semantics/allocate06.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements diff --git a/flang/test/Semantics/allocate07.f90 b/flang/test/Semantics/allocate07.f90 index 14077a24013e..5f261f332381 100644 --- a/flang/test/Semantics/allocate07.f90 +++ b/flang/test/Semantics/allocate07.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements subroutine C936(param_ca_4_assumed, param_ta_4_assumed, param_ca_4_deferred) diff --git a/flang/test/Semantics/allocate08.f90 b/flang/test/Semantics/allocate08.f90 index 3e235fcc9cdc..7733b3a0767a 100644 --- a/flang/test/Semantics/allocate08.f90 +++ b/flang/test/Semantics/allocate08.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements subroutine C945_a(srca, srcb, srcc, src_complex, src_logical, & diff --git a/flang/test/Semantics/allocate09.f90 b/flang/test/Semantics/allocate09.f90 index 61046fb13ce2..6e20521fedd7 100644 --- a/flang/test/Semantics/allocate09.f90 +++ b/flang/test/Semantics/allocate09.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements subroutine C946(param_ca_4_assumed, param_ta_4_assumed, param_ca_4_deferred) diff --git a/flang/test/Semantics/allocate10.f90 b/flang/test/Semantics/allocate10.f90 index c15dc57b4472..2746f8e1e6dc 100644 --- a/flang/test/Semantics/allocate10.f90 +++ b/flang/test/Semantics/allocate10.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements !TODO: mixing expr and source-expr? diff --git a/flang/test/Semantics/allocate11.f90 b/flang/test/Semantics/allocate11.f90 index b883edc4980a..594bd1ded385 100644 --- a/flang/test/Semantics/allocate11.f90 +++ b/flang/test/Semantics/allocate11.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements ! TODO: Function Pointer in allocate and derived types! diff --git a/flang/test/Semantics/allocate12.f90 b/flang/test/Semantics/allocate12.f90 index 41de8edc83ed..52fabf888f78 100644 --- a/flang/test/Semantics/allocate12.f90 +++ b/flang/test/Semantics/allocate12.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements subroutine C941_C942b_C950(xsrc, x1, a2, b2, cx1, ca2, cb1, cb2, c1) diff --git a/flang/test/Semantics/allocate13.f90 b/flang/test/Semantics/allocate13.f90 index b7010f5b0c89..99812f9d3df6 100644 --- a/flang/test/Semantics/allocate13.f90 +++ b/flang/test/Semantics/allocate13.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for semantic errors in ALLOCATE statements module not_iso_fortran_env diff --git a/flang/test/Semantics/altreturn01.f90 b/flang/test/Semantics/altreturn01.f90 index 0449ff774c36..b35d0799d154 100644 --- a/flang/test/Semantics/altreturn01.f90 +++ b/flang/test/Semantics/altreturn01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check calls with alt returns CALL TEST (N, *100, *200 ) diff --git a/flang/test/Semantics/altreturn02.f90 b/flang/test/Semantics/altreturn02.f90 index 74ff96933a83..a09df81f6ada 100644 --- a/flang/test/Semantics/altreturn02.f90 +++ b/flang/test/Semantics/altreturn02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check subroutine with alt return SUBROUTINE TEST (N, *, *) diff --git a/flang/test/Semantics/altreturn03.f90 b/flang/test/Semantics/altreturn03.f90 index 73a63860efc7..15c5ce650b96 100644 --- a/flang/test/Semantics/altreturn03.f90 +++ b/flang/test/Semantics/altreturn03.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for various alt return error conditions SUBROUTINE TEST (N, *, *) diff --git a/flang/test/Semantics/altreturn04.f90 b/flang/test/Semantics/altreturn04.f90 index e3714fb92223..4a9cf5b13ee3 100644 --- a/flang/test/Semantics/altreturn04.f90 +++ b/flang/test/Semantics/altreturn04.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Functions cannot use alt return REAL FUNCTION altreturn01(X) diff --git a/flang/test/Semantics/altreturn05.f90 b/flang/test/Semantics/altreturn05.f90 index cbd222cba9e7..baa8bcfa11ea 100644 --- a/flang/test/Semantics/altreturn05.f90 +++ b/flang/test/Semantics/altreturn05.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test extension: RETURN from main program return !ok diff --git a/flang/test/Semantics/assign01.f90 b/flang/test/Semantics/assign01.f90 index bd41a5b5cc9f..e8ec06785843 100644 --- a/flang/test/Semantics/assign01.f90 +++ b/flang/test/Semantics/assign01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! 10.2.3.1(2) All masks and LHS of assignments in a WHERE must conform subroutine s1 diff --git a/flang/test/Semantics/assign02.f90 b/flang/test/Semantics/assign02.f90 index e97be64d6aab..c504f7a8ab1f 100644 --- a/flang/test/Semantics/assign02.f90 +++ b/flang/test/Semantics/assign02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Pointer assignment constraints 10.2.2.2 module m1 diff --git a/flang/test/Semantics/assign03.f90 b/flang/test/Semantics/assign03.f90 index 5b9fe269addc..62749641ea29 100644 --- a/flang/test/Semantics/assign03.f90 +++ b/flang/test/Semantics/assign03.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Pointer assignment constraints 10.2.2.2 (see also assign02.f90) module m diff --git a/flang/test/Semantics/assign04.f90 b/flang/test/Semantics/assign04.f90 index dd0159bdd0bd..c12857c66fd2 100644 --- a/flang/test/Semantics/assign04.f90 +++ b/flang/test/Semantics/assign04.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! 9.4.5 subroutine s1 type :: t(k, l) diff --git a/flang/test/Semantics/bad-forward-type.f90 b/flang/test/Semantics/bad-forward-type.f90 index 62ad9d4b2b4c..0c6de01ad06e 100644 --- a/flang/test/Semantics/bad-forward-type.f90 +++ b/flang/test/Semantics/bad-forward-type.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Forward references to derived types (error cases) !ERROR: The derived type 'undef' was forward-referenced but not defined diff --git a/flang/test/Semantics/bindings01.f90 b/flang/test/Semantics/bindings01.f90 index 54aaacd2e9f8..4c517ad6c439 100644 --- a/flang/test/Semantics/bindings01.f90 +++ b/flang/test/Semantics/bindings01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Confirm enforcement of constraints and restrictions in 7.5.7.3 ! and C779-C785. diff --git a/flang/test/Semantics/block-data01.f90 b/flang/test/Semantics/block-data01.f90 index 164709118f6f..d9c6dcd0843a 100644 --- a/flang/test/Semantics/block-data01.f90 +++ b/flang/test/Semantics/block-data01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test BLOCK DATA subprogram (14.3) block data foo !ERROR: IMPORT is not allowed in a BLOCK DATA subprogram diff --git a/flang/test/Semantics/blockconstruct01.f90 b/flang/test/Semantics/blockconstruct01.f90 index 7f7eec5b56c3..86c4ff1a77bd 100644 --- a/flang/test/Semantics/blockconstruct01.f90 +++ b/flang/test/Semantics/blockconstruct01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1107 -- COMMON, EQUIVALENCE, INTENT, NAMELIST, OPTIONAL, VALUE or ! STATEMENT FUNCTIONS not allow in specification part diff --git a/flang/test/Semantics/blockconstruct02.f90 b/flang/test/Semantics/blockconstruct02.f90 index 2a1a95f312bf..77ce3c1a8f57 100644 --- a/flang/test/Semantics/blockconstruct02.f90 +++ b/flang/test/Semantics/blockconstruct02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1108 -- Save statement in a BLOCK construct shall not conatin a ! saved-entity-list that does not specify a common-block-name diff --git a/flang/test/Semantics/blockconstruct03.f90 b/flang/test/Semantics/blockconstruct03.f90 index df5aff7699ea..3f1974d19408 100644 --- a/flang/test/Semantics/blockconstruct03.f90 +++ b/flang/test/Semantics/blockconstruct03.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Tests implemented for this standard: ! Block Construct ! C1109 diff --git a/flang/test/Semantics/c_f_pointer.f90 b/flang/test/Semantics/c_f_pointer.f90 index 1064461c509d..ab1b479cfa7d 100644 --- a/flang/test/Semantics/c_f_pointer.f90 +++ b/flang/test/Semantics/c_f_pointer.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Enforce 18.2.3.3 program test diff --git a/flang/test/Semantics/call01.f90 b/flang/test/Semantics/call01.f90 index 88274dd42844..ed77fb81026f 100644 --- a/flang/test/Semantics/call01.f90 +++ b/flang/test/Semantics/call01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Confirm enforcement of constraints and restrictions in 15.6.2.1 non_recursive function f01(n) result(res) diff --git a/flang/test/Semantics/call02.f90 b/flang/test/Semantics/call02.f90 index 5d9bdf1cd5a2..e100a8fcc483 100644 --- a/flang/test/Semantics/call02.f90 +++ b/flang/test/Semantics/call02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! 15.5.1 procedure reference constraints and restrictions subroutine s01(elem, subr) diff --git a/flang/test/Semantics/call03.f90 b/flang/test/Semantics/call03.f90 index 098106aed45e..13aba93a2f00 100644 --- a/flang/test/Semantics/call03.f90 +++ b/flang/test/Semantics/call03.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test 15.5.2.4 constraints and restrictions for non-POINTER non-ALLOCATABLE ! dummy arguments. diff --git a/flang/test/Semantics/call04.f90 b/flang/test/Semantics/call04.f90 index 3064fee5decc..120cd5435a73 100644 --- a/flang/test/Semantics/call04.f90 +++ b/flang/test/Semantics/call04.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test 8.5.10 & 8.5.18 constraints on dummy argument declarations module m diff --git a/flang/test/Semantics/call05.f90 b/flang/test/Semantics/call05.f90 index 80f1874ff2d5..a7cd6d9f9b78 100644 --- a/flang/test/Semantics/call05.f90 +++ b/flang/test/Semantics/call05.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test 15.5.2.5 constraints and restrictions for POINTER & ALLOCATABLE ! arguments when both sides of the call have the same attributes. diff --git a/flang/test/Semantics/call06.f90 b/flang/test/Semantics/call06.f90 index eb4bd3755f87..77eb0c406e5e 100644 --- a/flang/test/Semantics/call06.f90 +++ b/flang/test/Semantics/call06.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test 15.5.2.6 constraints and restrictions for ALLOCATABLE ! dummy arguments. diff --git a/flang/test/Semantics/call07.f90 b/flang/test/Semantics/call07.f90 index f596e3600288..af9be0235435 100644 --- a/flang/test/Semantics/call07.f90 +++ b/flang/test/Semantics/call07.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test 15.5.2.7 constraints and restrictions for POINTER dummy arguments. module m diff --git a/flang/test/Semantics/call08.f90 b/flang/test/Semantics/call08.f90 index 88ec7e3b4cca..ae4497f316f7 100644 --- a/flang/test/Semantics/call08.f90 +++ b/flang/test/Semantics/call08.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test 15.5.2.8 coarray dummy arguments module m diff --git a/flang/test/Semantics/call09.f90 b/flang/test/Semantics/call09.f90 index 02224477a28f..337932d3fe0d 100644 --- a/flang/test/Semantics/call09.f90 +++ b/flang/test/Semantics/call09.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test 15.5.2.9(2,3,5) dummy procedure requirements module m diff --git a/flang/test/Semantics/call10.f90 b/flang/test/Semantics/call10.f90 index 567d85d5d0e0..74a0474175f6 100644 --- a/flang/test/Semantics/call10.f90 +++ b/flang/test/Semantics/call10.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test 15.7 (C1583-C1590, C1592-C1599) constraints and restrictions ! for pure procedures. ! (C1591 is tested in call11.f90; C1594 in call12.f90.) diff --git a/flang/test/Semantics/call11.f90 b/flang/test/Semantics/call11.f90 index b53b40334e93..d7b590427794 100644 --- a/flang/test/Semantics/call11.f90 +++ b/flang/test/Semantics/call11.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test 15.7 C1591 & others: contexts requiring pure subprograms module m diff --git a/flang/test/Semantics/call12.f90 b/flang/test/Semantics/call12.f90 index 3ce0812560ac..e25a2608c441 100644 --- a/flang/test/Semantics/call12.f90 +++ b/flang/test/Semantics/call12.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test 15.7 C1594 - prohibited assignments in pure subprograms module used diff --git a/flang/test/Semantics/call13.f90 b/flang/test/Semantics/call13.f90 index 952a7d0c8b1d..23ef745f8e1c 100644 --- a/flang/test/Semantics/call13.f90 +++ b/flang/test/Semantics/call13.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test 15.4.2.2 constraints and restrictions for calls to implicit ! interfaces diff --git a/flang/test/Semantics/call14.f90 b/flang/test/Semantics/call14.f90 index e25620b2694b..b874e6b00912 100644 --- a/flang/test/Semantics/call14.f90 +++ b/flang/test/Semantics/call14.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test 8.5.18 constraints on the VALUE attribute module m diff --git a/flang/test/Semantics/call15.f90 b/flang/test/Semantics/call15.f90 index 08886e4e7c6d..1f6646755205 100644 --- a/flang/test/Semantics/call15.f90 +++ b/flang/test/Semantics/call15.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C711 An assumed-type actual argument that corresponds to an assumed-rank ! dummy argument shall be assumed-shape or assumed-rank. subroutine s(arg1, arg2, arg3) diff --git a/flang/test/Semantics/canondo16.f90 b/flang/test/Semantics/canondo16.f90 index d5c5db464930..8eebde23b22f 100644 --- a/flang/test/Semantics/canondo16.f90 +++ b/flang/test/Semantics/canondo16.f90 @@ -1,11 +1,11 @@ -! RUN: %S/test_any.sh %s %flang %t +! RUN: %S/test_any.sh %s %f18 %t ! Error test -- DO loop uses obsolete loop termination statement ! See R1131 and C1133 ! By default, this is not an error and label do are rewritten to non-label do. ! A warning is generated with -Mstandard -! EXEC: ${F18} -funparse-with-symbols -Mstandard -I../../tools/f18/include %s 2>&1 | ${FileCheck} %s +! EXEC: ${F18} -funparse-with-symbols -Mstandard -I../../include/flang %s 2>&1 | ${FileCheck} %s ! CHECK: end do diff --git a/flang/test/Semantics/coarrays01.f90 b/flang/test/Semantics/coarrays01.f90 index 3e8e1672a47b..c96e76ceebbd 100644 --- a/flang/test/Semantics/coarrays01.f90 +++ b/flang/test/Semantics/coarrays01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test selector and team-value in CHANGE TEAM statement ! OK diff --git a/flang/test/Semantics/complex01.f90 b/flang/test/Semantics/complex01.f90 index c70f0defad6a..060760ff6e5a 100644 --- a/flang/test/Semantics/complex01.f90 +++ b/flang/test/Semantics/complex01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C718 Each named constant in a complex literal constant shall be of type ! integer or real. subroutine s() diff --git a/flang/test/Semantics/computed-goto01.f90 b/flang/test/Semantics/computed-goto01.f90 index 9f24996f41a0..ff38b729608c 100644 --- a/flang/test/Semantics/computed-goto01.f90 +++ b/flang/test/Semantics/computed-goto01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check that a basic computed goto compiles INTEGER, DIMENSION (2) :: B diff --git a/flang/test/Semantics/computed-goto02.f90 b/flang/test/Semantics/computed-goto02.f90 index eea61a827052..aaca63ab3bad 100644 --- a/flang/test/Semantics/computed-goto02.f90 +++ b/flang/test/Semantics/computed-goto02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check that computed goto express must be a scalar integer expression ! TODO: PGI, for example, accepts a float & converts the value to int. diff --git a/flang/test/Semantics/critical01.f90 b/flang/test/Semantics/critical01.f90 index 5ca97ade6998..1fa2553a5d9a 100644 --- a/flang/test/Semantics/critical01.f90 +++ b/flang/test/Semantics/critical01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !C1117 subroutine test1(a, i) diff --git a/flang/test/Semantics/critical02.f90 b/flang/test/Semantics/critical02.f90 index ba5e0f4c55a7..a339c46c3192 100644 --- a/flang/test/Semantics/critical02.f90 +++ b/flang/test/Semantics/critical02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !C1118 subroutine test1 diff --git a/flang/test/Semantics/critical03.f90 b/flang/test/Semantics/critical03.f90 index 2ab60e5d59a9..2964a3b5321f 100644 --- a/flang/test/Semantics/critical03.f90 +++ b/flang/test/Semantics/critical03.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !C1119 subroutine test1(a, i) diff --git a/flang/test/Semantics/data01.f90 b/flang/test/Semantics/data01.f90 index 4bdf7ea9dd4a..1c8608993868 100644 --- a/flang/test/Semantics/data01.f90 +++ b/flang/test/Semantics/data01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !Test for checking data constraints, C882-C887 module m1 type person diff --git a/flang/test/Semantics/data02.f90 b/flang/test/Semantics/data02.f90 index ac6902622d83..361f3a2793a3 100644 --- a/flang/test/Semantics/data02.f90 +++ b/flang/test/Semantics/data02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check that expressions are analyzed in data statements subroutine s1 diff --git a/flang/test/Semantics/deallocate01.f90 b/flang/test/Semantics/deallocate01.f90 index 8aaf14496d71..9aa69e77876d 100644 --- a/flang/test/Semantics/deallocate01.f90 +++ b/flang/test/Semantics/deallocate01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test that DEALLOCATE works INTEGER, PARAMETER :: maxvalue=1024 diff --git a/flang/test/Semantics/deallocate04.f90 b/flang/test/Semantics/deallocate04.f90 index 2a1ad62b9920..ce9acf994684 100644 --- a/flang/test/Semantics/deallocate04.f90 +++ b/flang/test/Semantics/deallocate04.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for type errors in DEALLOCATE statements INTEGER, PARAMETER :: maxvalue=1024 diff --git a/flang/test/Semantics/deallocate05.f90 b/flang/test/Semantics/deallocate05.f90 index fdc66004e2ce..862d88578b5f 100644 --- a/flang/test/Semantics/deallocate05.f90 +++ b/flang/test/Semantics/deallocate05.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for semantic errors in DEALLOCATE statements Module share diff --git a/flang/test/Semantics/doconcurrent01.f90 b/flang/test/Semantics/doconcurrent01.f90 index a4161a5c3073..7a3f9c078e00 100644 --- a/flang/test/Semantics/doconcurrent01.f90 +++ b/flang/test/Semantics/doconcurrent01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1141 ! A reference to the procedure IEEE_SET_HALTING_MODE ! from the intrinsic ! module IEEE_EXCEPTIONS, shall not ! appear within a DO CONCURRENT construct. diff --git a/flang/test/Semantics/doconcurrent05.f90 b/flang/test/Semantics/doconcurrent05.f90 index d92ef6d18322..df548f23e8b5 100644 --- a/flang/test/Semantics/doconcurrent05.f90 +++ b/flang/test/Semantics/doconcurrent05.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1167 -- An exit-stmt shall not appear within a DO CONCURRENT construct if ! it belongs to that construct or an outer construct. diff --git a/flang/test/Semantics/doconcurrent06.f90 b/flang/test/Semantics/doconcurrent06.f90 index f178b7a11640..e20a830f5d80 100644 --- a/flang/test/Semantics/doconcurrent06.f90 +++ b/flang/test/Semantics/doconcurrent06.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1167 -- An exit-stmt shall not appear within a DO CONCURRENT construct if ! it belongs to that construct or an outer construct. diff --git a/flang/test/Semantics/doconcurrent08.f90 b/flang/test/Semantics/doconcurrent08.f90 index 91a077fade49..826bc84b20ae 100644 --- a/flang/test/Semantics/doconcurrent08.f90 +++ b/flang/test/Semantics/doconcurrent08.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1140 -- A statement that might result in the deallocation of a polymorphic ! entity shall not appear within a DO CONCURRENT construct. module m1 diff --git a/flang/test/Semantics/dosemantics01.f90 b/flang/test/Semantics/dosemantics01.f90 index 2261f184e3cc..55eae4582396 100644 --- a/flang/test/Semantics/dosemantics01.f90 +++ b/flang/test/Semantics/dosemantics01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1131 -- check valid and invalid DO loop naming PROGRAM C1131 diff --git a/flang/test/Semantics/dosemantics02.f90 b/flang/test/Semantics/dosemantics02.f90 index 96047f0a3678..c40d3b842dbd 100644 --- a/flang/test/Semantics/dosemantics02.f90 +++ b/flang/test/Semantics/dosemantics02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1121 -- any procedure referenced in a concurrent header must be pure ! Also, check that the step expressions are not zero. This is prohibited by diff --git a/flang/test/Semantics/dosemantics03.f90 b/flang/test/Semantics/dosemantics03.f90 index c063a7b8c854..f82a7e4879f7 100644 --- a/flang/test/Semantics/dosemantics03.f90 +++ b/flang/test/Semantics/dosemantics03.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Issue 458 -- semantic checks for a normal DO loop. The DO variable ! and the initial, final, and step expressions must be INTEGER if the ! options for standard conformance and turning warnings into errors diff --git a/flang/test/Semantics/dosemantics04.f90 b/flang/test/Semantics/dosemantics04.f90 index 35a3c9493ca2..80bccf59d55e 100644 --- a/flang/test/Semantics/dosemantics04.f90 +++ b/flang/test/Semantics/dosemantics04.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1123 -- Expressions in DO CONCURRENT header cannot reference variables ! declared in the same header PROGRAM dosemantics04 diff --git a/flang/test/Semantics/dosemantics05.f90 b/flang/test/Semantics/dosemantics05.f90 index f565f9b71679..4e660498e3a3 100644 --- a/flang/test/Semantics/dosemantics05.f90 +++ b/flang/test/Semantics/dosemantics05.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test DO loop semantics for constraint C1130 -- ! The constraint states that "If the locality-spec DEFAULT ( NONE ) appears in a ! DO CONCURRENT statement; a variable that is a local or construct entity of a diff --git a/flang/test/Semantics/dosemantics06.f90 b/flang/test/Semantics/dosemantics06.f90 index 41b9598970b5..445eadcec6ca 100644 --- a/flang/test/Semantics/dosemantics06.f90 +++ b/flang/test/Semantics/dosemantics06.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1131, C1133 -- check valid and invalid DO loop naming ! C1131 (R1119) If the do-stmt of a do-construct specifies a do-construct-name, ! the corresponding end-do shall be an end-do-stmt specifying the same diff --git a/flang/test/Semantics/dosemantics07.f90 b/flang/test/Semantics/dosemantics07.f90 index f1450dda31eb..95584075e2cc 100644 --- a/flang/test/Semantics/dosemantics07.f90 +++ b/flang/test/Semantics/dosemantics07.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !C1132 ! If the do-stmt is a nonlabel-do-stmt, the corresponding end-do shall be an ! end-do-stmt. diff --git a/flang/test/Semantics/dosemantics08.f90 b/flang/test/Semantics/dosemantics08.f90 index 388fb75254f8..431443a11a80 100644 --- a/flang/test/Semantics/dosemantics08.f90 +++ b/flang/test/Semantics/dosemantics08.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1138 -- ! A branch (11.2) within a DO CONCURRENT construct shall not have a branch ! target that is outside the construct. diff --git a/flang/test/Semantics/dosemantics09.f90 b/flang/test/Semantics/dosemantics09.f90 index 46136f29c74e..3d53e39ff3ee 100644 --- a/flang/test/Semantics/dosemantics09.f90 +++ b/flang/test/Semantics/dosemantics09.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !C1129 !A variable that is referenced by the scalar-mask-expr of a !concurrent-header or by any concurrent-limit or concurrent-step in that diff --git a/flang/test/Semantics/dosemantics10.f90 b/flang/test/Semantics/dosemantics10.f90 index 561f9b7fb7ea..3d813184a3b4 100644 --- a/flang/test/Semantics/dosemantics10.f90 +++ b/flang/test/Semantics/dosemantics10.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1134 A CYCLE statement must be within a DO construct ! ! C1166 An EXIT statement must be within a DO construct diff --git a/flang/test/Semantics/dosemantics11.f90 b/flang/test/Semantics/dosemantics11.f90 index 760f9f5f9b60..226f0073f9a4 100644 --- a/flang/test/Semantics/dosemantics11.f90 +++ b/flang/test/Semantics/dosemantics11.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1135 A cycle-stmt shall not appear within a CHANGE TEAM, CRITICAL, or DO ! CONCURRENT construct if it belongs to an outer construct. ! diff --git a/flang/test/Semantics/dosemantics12.f90 b/flang/test/Semantics/dosemantics12.f90 index 48ecd14feda5..4cd406e0892b 100644 --- a/flang/test/Semantics/dosemantics12.f90 +++ b/flang/test/Semantics/dosemantics12.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. ! ! Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/flang/test/Semantics/entry01.f90 b/flang/test/Semantics/entry01.f90 index ccb03a7f6083..f458ef515451 100644 --- a/flang/test/Semantics/entry01.f90 +++ b/flang/test/Semantics/entry01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Tests valid and invalid ENTRY statements module m1 diff --git a/flang/test/Semantics/equivalence01.f90 b/flang/test/Semantics/equivalence01.f90 index 31b561e33b0d..68b2cd4d38ef 100644 --- a/flang/test/Semantics/equivalence01.f90 +++ b/flang/test/Semantics/equivalence01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s1 integer i, j real r(2) diff --git a/flang/test/Semantics/expr-errors01.f90 b/flang/test/Semantics/expr-errors01.f90 index a479e863dcaf..36064553684c 100644 --- a/flang/test/Semantics/expr-errors01.f90 +++ b/flang/test/Semantics/expr-errors01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1003 - can't parenthesize function call returning procedure pointer module m1 type :: dt diff --git a/flang/test/Semantics/expr-errors02.f90 b/flang/test/Semantics/expr-errors02.f90 index 4b0d6d4118f3..af51e1c3ee48 100644 --- a/flang/test/Semantics/expr-errors02.f90 +++ b/flang/test/Semantics/expr-errors02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test specification expressions module m diff --git a/flang/test/Semantics/forall01.f90 b/flang/test/Semantics/forall01.f90 index ecb243bc2a09..f4652370bd18 100644 --- a/flang/test/Semantics/forall01.f90 +++ b/flang/test/Semantics/forall01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine forall1 real :: a(9) !ERROR: 'i' is already declared in this scoping unit diff --git a/flang/test/Semantics/if_arith01.f90 b/flang/test/Semantics/if_arith01.f90 index 5ec06b47485d..16e616fc5a0d 100644 --- a/flang/test/Semantics/if_arith01.f90 +++ b/flang/test/Semantics/if_arith01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check that a basic arithmetic if compiles. if ( A ) 100, 200, 300 diff --git a/flang/test/Semantics/if_arith02.f90 b/flang/test/Semantics/if_arith02.f90 index f8e24b42dffa..4dfe72d36a5d 100644 --- a/flang/test/Semantics/if_arith02.f90 +++ b/flang/test/Semantics/if_arith02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check that only labels are allowed in arithmetic if statements. ! TODO: Revisit error message "expected 'ASSIGN'" etc. ! TODO: Revisit error message "expected one of '0123456789'" diff --git a/flang/test/Semantics/if_arith03.f90 b/flang/test/Semantics/if_arith03.f90 index 1e5eb67d184c..45ceec4e4e54 100644 --- a/flang/test/Semantics/if_arith03.f90 +++ b/flang/test/Semantics/if_arith03.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !ERROR: label '600' was not found diff --git a/flang/test/Semantics/if_arith04.f90 b/flang/test/Semantics/if_arith04.f90 index 9a436cd5eb67..d947b0b1a7b0 100644 --- a/flang/test/Semantics/if_arith04.f90 +++ b/flang/test/Semantics/if_arith04.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Make sure arithmetic if expressions are non-complex numeric exprs. INTEGER I diff --git a/flang/test/Semantics/if_construct01.f90 b/flang/test/Semantics/if_construct01.f90 index c133b7d8cc9f..adac3c252cc2 100644 --- a/flang/test/Semantics/if_construct01.f90 +++ b/flang/test/Semantics/if_construct01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Simple check that if constructs are ok. if (a < b) then diff --git a/flang/test/Semantics/if_construct02.f90 b/flang/test/Semantics/if_construct02.f90 index 9ba6caa45355..de9428649937 100644 --- a/flang/test/Semantics/if_construct02.f90 +++ b/flang/test/Semantics/if_construct02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check that if constructs only accept scalar logical expressions. ! TODO: expand the test to check this restriction for more types. diff --git a/flang/test/Semantics/if_stmt01.f90 b/flang/test/Semantics/if_stmt01.f90 index 51454a9d2116..337d5190e329 100644 --- a/flang/test/Semantics/if_stmt01.f90 +++ b/flang/test/Semantics/if_stmt01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Simple check that if statements are ok. IF (A > 0.0) A = LOG (A) diff --git a/flang/test/Semantics/if_stmt02.f90 b/flang/test/Semantics/if_stmt02.f90 index 71c458381ac2..5672811c4670 100644 --- a/flang/test/Semantics/if_stmt02.f90 +++ b/flang/test/Semantics/if_stmt02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !ERROR: IF statement is not allowed in IF statement IF (A > 0.0) IF (B < 0.0) A = LOG (A) END diff --git a/flang/test/Semantics/if_stmt03.f90 b/flang/test/Semantics/if_stmt03.f90 index 2a2595404960..970b70e00889 100644 --- a/flang/test/Semantics/if_stmt03.f90 +++ b/flang/test/Semantics/if_stmt03.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check that non-logical expressions are not allowed. ! Check that non-scalar expressions are not allowed. ! TODO: Insure all non-logicals are prohibited. diff --git a/flang/test/Semantics/implicit01.f90 b/flang/test/Semantics/implicit01.f90 index f0893f7ed33f..5cc8709a4dfd 100644 --- a/flang/test/Semantics/implicit01.f90 +++ b/flang/test/Semantics/implicit01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s1 implicit none !ERROR: More than one IMPLICIT NONE statement diff --git a/flang/test/Semantics/implicit02.f90 b/flang/test/Semantics/implicit02.f90 index 5d2b6e09474f..f30170587cf0 100644 --- a/flang/test/Semantics/implicit02.f90 +++ b/flang/test/Semantics/implicit02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s1 implicit none !ERROR: IMPLICIT statement after IMPLICIT NONE or IMPLICIT NONE(TYPE) statement diff --git a/flang/test/Semantics/implicit03.f90 b/flang/test/Semantics/implicit03.f90 index 9636743233a3..bb6c4958da2d 100644 --- a/flang/test/Semantics/implicit03.f90 +++ b/flang/test/Semantics/implicit03.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s1 implicit integer(a-z) !ERROR: IMPLICIT NONE statement after IMPLICIT statement diff --git a/flang/test/Semantics/implicit04.f90 b/flang/test/Semantics/implicit04.f90 index 86adb95f9852..20de8c403037 100644 --- a/flang/test/Semantics/implicit04.f90 +++ b/flang/test/Semantics/implicit04.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s parameter(a=1.0) !ERROR: IMPLICIT NONE statement after PARAMETER statement diff --git a/flang/test/Semantics/implicit05.f90 b/flang/test/Semantics/implicit05.f90 index 7649c228fa44..e6dec7d61533 100644 --- a/flang/test/Semantics/implicit05.f90 +++ b/flang/test/Semantics/implicit05.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s !ERROR: 'a' does not follow 'b' alphabetically implicit integer(b-a) diff --git a/flang/test/Semantics/implicit06.f90 b/flang/test/Semantics/implicit06.f90 index 3f6672008d53..9f54282c2fd5 100644 --- a/flang/test/Semantics/implicit06.f90 +++ b/flang/test/Semantics/implicit06.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s1 implicit integer(a-c) !ERROR: More than one implicit type specified for 'c' diff --git a/flang/test/Semantics/implicit07.f90 b/flang/test/Semantics/implicit07.f90 index 68fa37de8ce7..5ec659233f85 100644 --- a/flang/test/Semantics/implicit07.f90 +++ b/flang/test/Semantics/implicit07.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t implicit none(external) external x call x diff --git a/flang/test/Semantics/implicit08.f90 b/flang/test/Semantics/implicit08.f90 index 44e96d89855e..a4a1c33fb233 100644 --- a/flang/test/Semantics/implicit08.f90 +++ b/flang/test/Semantics/implicit08.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s1 block !ERROR: IMPLICIT statement is not allowed in a BLOCK construct diff --git a/flang/test/Semantics/init01.f90 b/flang/test/Semantics/init01.f90 index 1fc1ed877fa3..f8481506a809 100644 --- a/flang/test/Semantics/init01.f90 +++ b/flang/test/Semantics/init01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Object pointer initializer error tests subroutine test(j) diff --git a/flang/test/Semantics/int-literals.f90 b/flang/test/Semantics/int-literals.f90 index 3c48b7e1b7da..01d31c5c0ca6 100644 --- a/flang/test/Semantics/int-literals.f90 +++ b/flang/test/Semantics/int-literals.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Fortran syntax considers signed int literals in complex literals ! to be a distinct production, not an application of unary +/- to ! an unsigned int literal, so they're used here to test overflow diff --git a/flang/test/Semantics/io01.f90 b/flang/test/Semantics/io01.f90 index 81b537d7e4c5..56936b6e68fe 100644 --- a/flang/test/Semantics/io01.f90 +++ b/flang/test/Semantics/io01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t character(len=20) :: access = "direcT" character(len=20) :: access_(2) = (/"direcT", "streaM"/) character(len=20) :: action_(2) = (/"reaD ", "writE"/) diff --git a/flang/test/Semantics/io02.f90 b/flang/test/Semantics/io02.f90 index 7cb901d34027..a405f3e91502 100644 --- a/flang/test/Semantics/io02.f90 +++ b/flang/test/Semantics/io02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t integer :: unit10 = 10 integer :: unit11 = 11 diff --git a/flang/test/Semantics/io03.f90 b/flang/test/Semantics/io03.f90 index a6696176b126..6c91afc00b01 100644 --- a/flang/test/Semantics/io03.f90 +++ b/flang/test/Semantics/io03.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t character(kind=1,len=50) internal_file character(kind=2,len=50) internal_file2 character(kind=4,len=50) internal_file4 diff --git a/flang/test/Semantics/io04.f90 b/flang/test/Semantics/io04.f90 index 09776ef94ab1..5cda7fff8bc8 100644 --- a/flang/test/Semantics/io04.f90 +++ b/flang/test/Semantics/io04.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t character(kind=1,len=50) internal_file character(kind=1,len=100) msg character(20) sign diff --git a/flang/test/Semantics/io05.f90 b/flang/test/Semantics/io05.f90 index 1df878197237..8d10ab12416d 100644 --- a/flang/test/Semantics/io05.f90 +++ b/flang/test/Semantics/io05.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t character*20 c(25), cv character(kind=1,len=59) msg logical*2 v(5), lv diff --git a/flang/test/Semantics/io06.f90 b/flang/test/Semantics/io06.f90 index eba437c86c86..1b19fc6bc217 100644 --- a/flang/test/Semantics/io06.f90 +++ b/flang/test/Semantics/io06.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t character(kind=1,len=100) msg1 character(kind=2,len=200) msg2 integer(1) stat1 diff --git a/flang/test/Semantics/io07.f90 b/flang/test/Semantics/io07.f90 index 9462a099d67e..e3154689ab80 100644 --- a/flang/test/Semantics/io07.f90 +++ b/flang/test/Semantics/io07.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t 1001 format(A) !ERROR: Format statement must be labeled diff --git a/flang/test/Semantics/io08.f90 b/flang/test/Semantics/io08.f90 index 1b75e8094a9a..ca9638fb3a3f 100644 --- a/flang/test/Semantics/io08.f90 +++ b/flang/test/Semantics/io08.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t write(*,*) write(*,'()') write(*,'(A)') diff --git a/flang/test/Semantics/io09.f90 b/flang/test/Semantics/io09.f90 index 5f50e4e0151e..7ce5e6435568 100644 --- a/flang/test/Semantics/io09.f90 +++ b/flang/test/Semantics/io09.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !ERROR: String edit descriptor in READ format expression read(*,'("abc")') diff --git a/flang/test/Semantics/io10.f90 b/flang/test/Semantics/io10.f90 index 90ae8b194330..a3023861c1cf 100644 --- a/flang/test/Semantics/io10.f90 +++ b/flang/test/Semantics/io10.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !OPTIONS: -Mstandard write(*, '(B0)') diff --git a/flang/test/Semantics/kinds02.f90 b/flang/test/Semantics/kinds02.f90 index f1ff0b27caf5..bdc998bbdfe7 100644 --- a/flang/test/Semantics/kinds02.f90 +++ b/flang/test/Semantics/kinds02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C712 The value of scalar-int-constant-expr shall be nonnegative and ! shall specify a representation method that exists on the processor. ! C714 The value of kind-param shall be nonnegative. diff --git a/flang/test/Semantics/kinds04.f90 b/flang/test/Semantics/kinds04.f90 index af6a8965ca65..54f953fec5ff 100644 --- a/flang/test/Semantics/kinds04.f90 +++ b/flang/test/Semantics/kinds04.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C716 If both kind-param and exponent-letter appear, exponent-letter ! shall be E. ! C717 The value of kind-param shall specify an approximation method that diff --git a/flang/test/Semantics/misc-declarations.f90 b/flang/test/Semantics/misc-declarations.f90 index 9103ad7bcf7d..7680eed793bc 100644 --- a/flang/test/Semantics/misc-declarations.f90 +++ b/flang/test/Semantics/misc-declarations.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Miscellaneous constraint and requirement checking on declarations: ! - 8.5.6.2 & 8.5.6.3 constraints on coarrays ! - 8.5.19 constraints on the VOLATILE attribute diff --git a/flang/test/Semantics/namelist01.f90 b/flang/test/Semantics/namelist01.f90 index f659c998c7ef..b85357faf9ae 100644 --- a/flang/test/Semantics/namelist01.f90 +++ b/flang/test/Semantics/namelist01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test for checking namelist constraints, C8103-C8105 module dup diff --git a/flang/test/Semantics/null01.f90 b/flang/test/Semantics/null01.f90 index 09c6dce22c48..478bedbc44ed 100644 --- a/flang/test/Semantics/null01.f90 +++ b/flang/test/Semantics/null01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! NULL() intrinsic function error tests subroutine test diff --git a/flang/test/Semantics/nullify01.f90 b/flang/test/Semantics/nullify01.f90 index 9af635f8f08c..62cde3055f77 100644 --- a/flang/test/Semantics/nullify01.f90 +++ b/flang/test/Semantics/nullify01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test that NULLIFY works Module share diff --git a/flang/test/Semantics/nullify02.f90 b/flang/test/Semantics/nullify02.f90 index 49bcc9ef5d11..7a2408348cd4 100644 --- a/flang/test/Semantics/nullify02.f90 +++ b/flang/test/Semantics/nullify02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Check for semantic errors in NULLIFY statements INTEGER, PARAMETER :: maxvalue=1024 diff --git a/flang/test/Semantics/omp-atomic.f90 b/flang/test/Semantics/omp-atomic.f90 index 760d1ee4f619..2a27bfaf6011 100644 --- a/flang/test/Semantics/omp-atomic.f90 +++ b/flang/test/Semantics/omp-atomic.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! OPTIONS: -fopenmp ! Check OpenMP 2.13.6 atomic Construct diff --git a/flang/test/Semantics/omp-clause-validity01.f90 b/flang/test/Semantics/omp-clause-validity01.f90 index 523b2eeb6c10..bcfea4c5b250 100644 --- a/flang/test/Semantics/omp-clause-validity01.f90 +++ b/flang/test/Semantics/omp-clause-validity01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! OPTIONS: -fopenmp ! Check OpenMP clause validity for the following directives: diff --git a/flang/test/Semantics/omp-declarative-directive.f90 b/flang/test/Semantics/omp-declarative-directive.f90 index 639ed7d4d895..98787eea3031 100644 --- a/flang/test/Semantics/omp-declarative-directive.f90 +++ b/flang/test/Semantics/omp-declarative-directive.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! OPTIONS: -fopenmp ! Check OpenMP declarative directives diff --git a/flang/test/Semantics/omp-device-constructs.f90 b/flang/test/Semantics/omp-device-constructs.f90 index 7973dc2ef77f..15daec33580a 100644 --- a/flang/test/Semantics/omp-device-constructs.f90 +++ b/flang/test/Semantics/omp-device-constructs.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! OPTIONS: -fopenmp ! Check OpenMP clause validity for the following directives: ! 2.10 Device constructs diff --git a/flang/test/Semantics/omp-loop-association.f90 b/flang/test/Semantics/omp-loop-association.f90 index 22e9365b2f3f..036d7c3d124d 100644 --- a/flang/test/Semantics/omp-loop-association.f90 +++ b/flang/test/Semantics/omp-loop-association.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! OPTIONS: -fopenmp ! Check the association between OpenMPLoopConstruct and DoConstruct diff --git a/flang/test/Semantics/omp-nested01.f90 b/flang/test/Semantics/omp-nested01.f90 index 1c0e84ab8fd9..b13f536da27f 100644 --- a/flang/test/Semantics/omp-nested01.f90 +++ b/flang/test/Semantics/omp-nested01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! OPTIONS: -fopenmp ! Check OpenMP 2.17 Nesting of Regions diff --git a/flang/test/Semantics/omp-resolve01.f90 b/flang/test/Semantics/omp-resolve01.f90 index 528915e88f8d..47479b4954f7 100644 --- a/flang/test/Semantics/omp-resolve01.f90 +++ b/flang/test/Semantics/omp-resolve01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !OPTIONS: -fopenmp ! 2.4 An array section designates a subset of the elements in an array. Although diff --git a/flang/test/Semantics/omp-resolve02.f90 b/flang/test/Semantics/omp-resolve02.f90 index 3d341662b2da..3f28973a907b 100644 --- a/flang/test/Semantics/omp-resolve02.f90 +++ b/flang/test/Semantics/omp-resolve02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !OPTIONS: -fopenmp ! Test the effect to name resolution from illegal clause diff --git a/flang/test/Semantics/omp-resolve03.f90 b/flang/test/Semantics/omp-resolve03.f90 index a896ef30c9f4..8e20d23fafa6 100644 --- a/flang/test/Semantics/omp-resolve03.f90 +++ b/flang/test/Semantics/omp-resolve03.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !OPTIONS: -fopenmp ! 2.15.3 Although variables in common blocks can be accessed by use association diff --git a/flang/test/Semantics/omp-resolve04.f90 b/flang/test/Semantics/omp-resolve04.f90 index 234013898b87..a216616eb2fd 100644 --- a/flang/test/Semantics/omp-resolve04.f90 +++ b/flang/test/Semantics/omp-resolve04.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !OPTIONS: -fopenmp ! 2.15.3 Data-Sharing Attribute Clauses diff --git a/flang/test/Semantics/omp-resolve05.f90 b/flang/test/Semantics/omp-resolve05.f90 index ebc50476b499..dc15b18a18db 100644 --- a/flang/test/Semantics/omp-resolve05.f90 +++ b/flang/test/Semantics/omp-resolve05.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !OPTIONS: -fopenmp ! 2.15.3 Data-Sharing Attribute Clauses diff --git a/flang/test/Semantics/resolve01.f90 b/flang/test/Semantics/resolve01.f90 index eee8d662517f..f64599ec06a0 100644 --- a/flang/test/Semantics/resolve01.f90 +++ b/flang/test/Semantics/resolve01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t integer :: x !ERROR: The type of 'x' has already been declared real :: x diff --git a/flang/test/Semantics/resolve02.f90 b/flang/test/Semantics/resolve02.f90 index 0d8e83b0ed29..9978a95409e3 100644 --- a/flang/test/Semantics/resolve02.f90 +++ b/flang/test/Semantics/resolve02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s !ERROR: Declaration of 'x' conflicts with its use as internal procedure real :: x diff --git a/flang/test/Semantics/resolve03.f90 b/flang/test/Semantics/resolve03.f90 index 773aaab3d453..825509da84d7 100644 --- a/flang/test/Semantics/resolve03.f90 +++ b/flang/test/Semantics/resolve03.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t implicit none integer :: x !ERROR: No explicit type declared for 'y' diff --git a/flang/test/Semantics/resolve04.f90 b/flang/test/Semantics/resolve04.f90 index 5132b9f780f6..eeb6cb686896 100644 --- a/flang/test/Semantics/resolve04.f90 +++ b/flang/test/Semantics/resolve04.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !ERROR: No explicit type declared for 'f' function f() implicit none diff --git a/flang/test/Semantics/resolve05.f90 b/flang/test/Semantics/resolve05.f90 index d1960e1808b1..89d501c664fd 100644 --- a/flang/test/Semantics/resolve05.f90 +++ b/flang/test/Semantics/resolve05.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t program p integer :: p ! this is ok end diff --git a/flang/test/Semantics/resolve06.f90 b/flang/test/Semantics/resolve06.f90 index 276feb3b4ee4..c0fd7a1ae5d4 100644 --- a/flang/test/Semantics/resolve06.f90 +++ b/flang/test/Semantics/resolve06.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t implicit none allocatable :: x integer :: x diff --git a/flang/test/Semantics/resolve07.f90 b/flang/test/Semantics/resolve07.f90 index f2e46f42a9d1..08156c4343f8 100644 --- a/flang/test/Semantics/resolve07.f90 +++ b/flang/test/Semantics/resolve07.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s1 integer :: x(2) !ERROR: The dimensions of 'x' have already been declared diff --git a/flang/test/Semantics/resolve08.f90 b/flang/test/Semantics/resolve08.f90 index 7252c79ef033..db238a496133 100644 --- a/flang/test/Semantics/resolve08.f90 +++ b/flang/test/Semantics/resolve08.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t integer :: g(10) f(i) = i + 1 ! statement function g(i) = i + 2 ! mis-parsed array assignment diff --git a/flang/test/Semantics/resolve09.f90 b/flang/test/Semantics/resolve09.f90 index 5104a371a639..cf9195992455 100644 --- a/flang/test/Semantics/resolve09.f90 +++ b/flang/test/Semantics/resolve09.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t integer :: y procedure() :: a procedure(real) :: b diff --git a/flang/test/Semantics/resolve10.f90 b/flang/test/Semantics/resolve10.f90 index 9990935899fa..5506d3916c76 100644 --- a/flang/test/Semantics/resolve10.f90 +++ b/flang/test/Semantics/resolve10.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m public type t diff --git a/flang/test/Semantics/resolve11.f90 b/flang/test/Semantics/resolve11.f90 index d94c0f8c87d1..1ff6a63ebf07 100644 --- a/flang/test/Semantics/resolve11.f90 +++ b/flang/test/Semantics/resolve11.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m public i integer, private :: j diff --git a/flang/test/Semantics/resolve12.f90 b/flang/test/Semantics/resolve12.f90 index 03bad9f5616f..b68e3b76544f 100644 --- a/flang/test/Semantics/resolve12.f90 +++ b/flang/test/Semantics/resolve12.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m1 end diff --git a/flang/test/Semantics/resolve13.f90 b/flang/test/Semantics/resolve13.f90 index 6fc03b1e8be0..5ee05db5e782 100644 --- a/flang/test/Semantics/resolve13.f90 +++ b/flang/test/Semantics/resolve13.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m1 integer :: x integer, private :: y diff --git a/flang/test/Semantics/resolve14.f90 b/flang/test/Semantics/resolve14.f90 index 326fe8e94894..d24a5c621655 100644 --- a/flang/test/Semantics/resolve14.f90 +++ b/flang/test/Semantics/resolve14.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m1 integer :: x integer :: y diff --git a/flang/test/Semantics/resolve15.f90 b/flang/test/Semantics/resolve15.f90 index 1cca8ce3dd7b..d91713a2b91a 100644 --- a/flang/test/Semantics/resolve15.f90 +++ b/flang/test/Semantics/resolve15.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m real :: var interface i diff --git a/flang/test/Semantics/resolve16.f90 b/flang/test/Semantics/resolve16.f90 index 8ce084a26fe9..a9d0842db7be 100644 --- a/flang/test/Semantics/resolve16.f90 +++ b/flang/test/Semantics/resolve16.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m interface subroutine sub0 diff --git a/flang/test/Semantics/resolve17.f90 b/flang/test/Semantics/resolve17.f90 index f9c9451dcfe2..4d1afee86b1a 100644 --- a/flang/test/Semantics/resolve17.f90 +++ b/flang/test/Semantics/resolve17.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m integer :: foo !Note: PGI, Intel, and GNU allow this; NAG and Sun do not diff --git a/flang/test/Semantics/resolve18.f90 b/flang/test/Semantics/resolve18.f90 index dff395f4bc9b..50246ea01dc7 100644 --- a/flang/test/Semantics/resolve18.f90 +++ b/flang/test/Semantics/resolve18.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m1 implicit none contains diff --git a/flang/test/Semantics/resolve19.f90 b/flang/test/Semantics/resolve19.f90 index f28f2b45abdf..3234f4ccc1f2 100644 --- a/flang/test/Semantics/resolve19.f90 +++ b/flang/test/Semantics/resolve19.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m interface a subroutine s(x) diff --git a/flang/test/Semantics/resolve20.f90 b/flang/test/Semantics/resolve20.f90 index 38dbd2367fe4..b38b8e35a494 100644 --- a/flang/test/Semantics/resolve20.f90 +++ b/flang/test/Semantics/resolve20.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m abstract interface subroutine foo diff --git a/flang/test/Semantics/resolve21.f90 b/flang/test/Semantics/resolve21.f90 index 764537a565f5..dfd87b348591 100644 --- a/flang/test/Semantics/resolve21.f90 +++ b/flang/test/Semantics/resolve21.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s1 type :: t integer :: i diff --git a/flang/test/Semantics/resolve22.f90 b/flang/test/Semantics/resolve22.f90 index 3549ec76e777..b9290cb9de23 100644 --- a/flang/test/Semantics/resolve22.f90 +++ b/flang/test/Semantics/resolve22.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s1 !OK: interface followed by type with same name interface t diff --git a/flang/test/Semantics/resolve23.f90 b/flang/test/Semantics/resolve23.f90 index 41644843bf1f..ffd408f660dc 100644 --- a/flang/test/Semantics/resolve23.f90 +++ b/flang/test/Semantics/resolve23.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m type :: t real :: y diff --git a/flang/test/Semantics/resolve24.f90 b/flang/test/Semantics/resolve24.f90 index c2ce595d9054..5b4a1adb11ab 100644 --- a/flang/test/Semantics/resolve24.f90 +++ b/flang/test/Semantics/resolve24.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine test1 !ERROR: Generic interface 'foo' has both a function and a subroutine interface foo diff --git a/flang/test/Semantics/resolve25.f90 b/flang/test/Semantics/resolve25.f90 index 4d3ec8c81495..780c07535bac 100644 --- a/flang/test/Semantics/resolve25.f90 +++ b/flang/test/Semantics/resolve25.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m interface foo subroutine s1(x) diff --git a/flang/test/Semantics/resolve26.f90 b/flang/test/Semantics/resolve26.f90 index f39366faaef0..65cfccf0f68b 100644 --- a/flang/test/Semantics/resolve26.f90 +++ b/flang/test/Semantics/resolve26.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m1 interface module subroutine s() diff --git a/flang/test/Semantics/resolve27.f90 b/flang/test/Semantics/resolve27.f90 index b10105ed9e7d..c8e3d82b094f 100644 --- a/flang/test/Semantics/resolve27.f90 +++ b/flang/test/Semantics/resolve27.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m interface module subroutine s() diff --git a/flang/test/Semantics/resolve28.f90 b/flang/test/Semantics/resolve28.f90 index 0fd81807c97f..17e603251518 100644 --- a/flang/test/Semantics/resolve28.f90 +++ b/flang/test/Semantics/resolve28.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s type t end type diff --git a/flang/test/Semantics/resolve29.f90 b/flang/test/Semantics/resolve29.f90 index d328eba594e7..7dcd61671e5c 100644 --- a/flang/test/Semantics/resolve29.f90 +++ b/flang/test/Semantics/resolve29.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m type t1 end type diff --git a/flang/test/Semantics/resolve30.f90 b/flang/test/Semantics/resolve30.f90 index 98777124b134..c3abaf5fd1a6 100644 --- a/flang/test/Semantics/resolve30.f90 +++ b/flang/test/Semantics/resolve30.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s1 integer x block diff --git a/flang/test/Semantics/resolve31.f90 b/flang/test/Semantics/resolve31.f90 index 3c61cd0bb9dc..a1fb7cea54b1 100644 --- a/flang/test/Semantics/resolve31.f90 +++ b/flang/test/Semantics/resolve31.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s1 integer :: t0 !ERROR: 't0' is not a derived type diff --git a/flang/test/Semantics/resolve32.f90 b/flang/test/Semantics/resolve32.f90 index 317a0ad9ed12..1b0140e285ed 100644 --- a/flang/test/Semantics/resolve32.f90 +++ b/flang/test/Semantics/resolve32.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m2 public s2, s4 private s3 diff --git a/flang/test/Semantics/resolve33.f90 b/flang/test/Semantics/resolve33.f90 index 4a37c5fb57aa..d4265cd3e2a0 100644 --- a/flang/test/Semantics/resolve33.f90 +++ b/flang/test/Semantics/resolve33.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Derived type parameters module m diff --git a/flang/test/Semantics/resolve34.f90 b/flang/test/Semantics/resolve34.f90 index 9d148ff43046..39730cee62de 100644 --- a/flang/test/Semantics/resolve34.f90 +++ b/flang/test/Semantics/resolve34.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Extended derived types module m1 diff --git a/flang/test/Semantics/resolve35.f90 b/flang/test/Semantics/resolve35.f90 index 7f6a8ea9492b..d78c1cbd4b74 100644 --- a/flang/test/Semantics/resolve35.f90 +++ b/flang/test/Semantics/resolve35.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Construct names subroutine s1 diff --git a/flang/test/Semantics/resolve36.f90 b/flang/test/Semantics/resolve36.f90 index 7ed9391c2f9e..13f6a144db5c 100644 --- a/flang/test/Semantics/resolve36.f90 +++ b/flang/test/Semantics/resolve36.f90 @@ -1,8 +1,7 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1568 The procedure-name shall have been declared to be a separate module ! procedure in the containing program unit or an ancestor of that program unit. - module m1 interface module subroutine sub1(arg1) diff --git a/flang/test/Semantics/resolve37.f90 b/flang/test/Semantics/resolve37.f90 index a07ebbc6625b..c56ac3719dd7 100644 --- a/flang/test/Semantics/resolve37.f90 +++ b/flang/test/Semantics/resolve37.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C701 The type-param-value for a kind type parameter shall be a constant ! expression. This constraint looks like a mistake in the standard. integer, parameter :: k = 8 diff --git a/flang/test/Semantics/resolve38.f90 b/flang/test/Semantics/resolve38.f90 index 53e8db813380..98ac17f2d366 100644 --- a/flang/test/Semantics/resolve38.f90 +++ b/flang/test/Semantics/resolve38.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C772 module m1 type t1 diff --git a/flang/test/Semantics/resolve39.f90 b/flang/test/Semantics/resolve39.f90 index d0052f16f863..b34bbeca84f2 100644 --- a/flang/test/Semantics/resolve39.f90 +++ b/flang/test/Semantics/resolve39.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s1 implicit none real(8) :: x = 2.0 diff --git a/flang/test/Semantics/resolve40.f90 b/flang/test/Semantics/resolve40.f90 index 95c2c9e8034c..b4d8aa0d915a 100644 --- a/flang/test/Semantics/resolve40.f90 +++ b/flang/test/Semantics/resolve40.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s1 namelist /nl/x block diff --git a/flang/test/Semantics/resolve41.f90 b/flang/test/Semantics/resolve41.f90 index e2bf877016ed..40522d8f4b7b 100644 --- a/flang/test/Semantics/resolve41.f90 +++ b/flang/test/Semantics/resolve41.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m implicit none real, parameter :: a = 8.0 diff --git a/flang/test/Semantics/resolve42.f90 b/flang/test/Semantics/resolve42.f90 index 5b6ac9f88b2b..af5d6e5ee377 100644 --- a/flang/test/Semantics/resolve42.f90 +++ b/flang/test/Semantics/resolve42.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! 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(:) diff --git a/flang/test/Semantics/resolve43.f90 b/flang/test/Semantics/resolve43.f90 index 385dfedc34bd..2ef585a60021 100644 --- a/flang/test/Semantics/resolve43.f90 +++ b/flang/test/Semantics/resolve43.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Error tests for structure constructors. ! Errors caught by expression resolution are tested elsewhere; these are the ! errors meant to be caught by name resolution, as well as acceptable use diff --git a/flang/test/Semantics/resolve44.f90 b/flang/test/Semantics/resolve44.f90 index dd082adc89df..2d8b70178753 100644 --- a/flang/test/Semantics/resolve44.f90 +++ b/flang/test/Semantics/resolve44.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Error tests for recursive use of derived types. program main diff --git a/flang/test/Semantics/resolve45.f90 b/flang/test/Semantics/resolve45.f90 index e28dc33c4e72..bb5eaf4a5317 100644 --- a/flang/test/Semantics/resolve45.f90 +++ b/flang/test/Semantics/resolve45.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t function f1(x, y) integer x !ERROR: SAVE attribute may not be applied to dummy argument 'x' diff --git a/flang/test/Semantics/resolve46.f90 b/flang/test/Semantics/resolve46.f90 index 181ccfb5c280..da31741163ab 100644 --- a/flang/test/Semantics/resolve46.f90 +++ b/flang/test/Semantics/resolve46.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C1030 - pointers to intrinsic procedures program main intrinsic :: cos ! a specific & generic intrinsic name diff --git a/flang/test/Semantics/resolve47.f90 b/flang/test/Semantics/resolve47.f90 index 04dab5616855..0f27ee4b5fa2 100644 --- a/flang/test/Semantics/resolve47.f90 +++ b/flang/test/Semantics/resolve47.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m1 !ERROR: Logical constant '.true.' may not be used as a defined operator interface operator(.TRUE.) diff --git a/flang/test/Semantics/resolve48.f90 b/flang/test/Semantics/resolve48.f90 index 887505d16442..6651a72cfe84 100644 --- a/flang/test/Semantics/resolve48.f90 +++ b/flang/test/Semantics/resolve48.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test correct use-association of a derived type. module m1 implicit none diff --git a/flang/test/Semantics/resolve49.f90 b/flang/test/Semantics/resolve49.f90 index 97d2cbdb1267..583399044977 100644 --- a/flang/test/Semantics/resolve49.f90 +++ b/flang/test/Semantics/resolve49.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test section subscript program p1 real :: a(10,10) diff --git a/flang/test/Semantics/resolve50.f90 b/flang/test/Semantics/resolve50.f90 index 34d6f1c1d5d5..8158ab6bd72a 100644 --- a/flang/test/Semantics/resolve50.f90 +++ b/flang/test/Semantics/resolve50.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test coarray association in CHANGE TEAM statement subroutine s1 diff --git a/flang/test/Semantics/resolve51.f90 b/flang/test/Semantics/resolve51.f90 index de763ef49911..d2942a8f345b 100644 --- a/flang/test/Semantics/resolve51.f90 +++ b/flang/test/Semantics/resolve51.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test SELECT TYPE errors: C1157 subroutine s1() diff --git a/flang/test/Semantics/resolve52.f90 b/flang/test/Semantics/resolve52.f90 index 846b412f05ca..33eef54755af 100644 --- a/flang/test/Semantics/resolve52.f90 +++ b/flang/test/Semantics/resolve52.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Tests for C760: ! The passed-object dummy argument shall be a scalar, nonpointer, nonallocatable ! dummy data object with the same declared type as the type being defined; diff --git a/flang/test/Semantics/resolve53.f90 b/flang/test/Semantics/resolve53.f90 index 1aee5e79bcc9..e501941f5a6f 100644 --- a/flang/test/Semantics/resolve53.f90 +++ b/flang/test/Semantics/resolve53.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! 15.4.3.4.5 Restrictions on generic declarations ! Specific procedures of generic interfaces must be distinguishable. diff --git a/flang/test/Semantics/resolve54.f90 b/flang/test/Semantics/resolve54.f90 index f9f895fa7f05..f8b80fc126e4 100644 --- a/flang/test/Semantics/resolve54.f90 +++ b/flang/test/Semantics/resolve54.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Tests based on examples in C.10.6 ! C.10.6(10) diff --git a/flang/test/Semantics/resolve55.f90 b/flang/test/Semantics/resolve55.f90 index 98006bc0a07b..422168be90a8 100644 --- a/flang/test/Semantics/resolve55.f90 +++ b/flang/test/Semantics/resolve55.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Tests for C1128: ! A variable-name that appears in a LOCAL or LOCAL_INIT locality-spec shall not ! have the ALLOCATABLE; INTENT (IN); or OPTIONAL attribute; shall not be of diff --git a/flang/test/Semantics/resolve56.f90 b/flang/test/Semantics/resolve56.f90 index 1efa535bd434..ef99f99ec620 100644 --- a/flang/test/Semantics/resolve56.f90 +++ b/flang/test/Semantics/resolve56.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test that associations constructs can be correctly combined. The intrinsic ! functions are not what is tested here, they are only use to reveal the types ! of local variables. diff --git a/flang/test/Semantics/resolve57.f90 b/flang/test/Semantics/resolve57.f90 index 265decd3bcde..50843a1bbfbc 100644 --- a/flang/test/Semantics/resolve57.f90 +++ b/flang/test/Semantics/resolve57.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Tests for the last sentence of C1128: !A variable-name that is not permitted to appear in a variable definition !context shall not appear in a LOCAL or LOCAL_INIT locality-spec. diff --git a/flang/test/Semantics/resolve58.f90 b/flang/test/Semantics/resolve58.f90 index db11e6779335..15fe4675c17d 100644 --- a/flang/test/Semantics/resolve58.f90 +++ b/flang/test/Semantics/resolve58.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s1(x, y) !ERROR: Array pointer 'x' must have deferred shape or assumed rank real, pointer :: x(1:) ! C832 diff --git a/flang/test/Semantics/resolve59.f90 b/flang/test/Semantics/resolve59.f90 index fdc437030971..49e46a9c8c7d 100644 --- a/flang/test/Semantics/resolve59.f90 +++ b/flang/test/Semantics/resolve59.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Testing 15.6.2.2 point 4 (What function-name refers to depending on the ! presence of RESULT). diff --git a/flang/test/Semantics/resolve60.f90 b/flang/test/Semantics/resolve60.f90 index 3232bc0fb87a..811460e35975 100644 --- a/flang/test/Semantics/resolve60.f90 +++ b/flang/test/Semantics/resolve60.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Testing 7.6 enum ! OK diff --git a/flang/test/Semantics/resolve61.f90 b/flang/test/Semantics/resolve61.f90 index eb5ba13a07a3..fe2840c74921 100644 --- a/flang/test/Semantics/resolve61.f90 +++ b/flang/test/Semantics/resolve61.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t program p1 integer(8) :: a, b, c, d pointer(a, b) diff --git a/flang/test/Semantics/resolve62.f90 b/flang/test/Semantics/resolve62.f90 index 5de3a45e900f..1ce28f3426cc 100644 --- a/flang/test/Semantics/resolve62.f90 +++ b/flang/test/Semantics/resolve62.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Resolve generic based on number of arguments subroutine s1 interface f diff --git a/flang/test/Semantics/resolve63.f90 b/flang/test/Semantics/resolve63.f90 index 07ae767d676b..59091574d5d8 100644 --- a/flang/test/Semantics/resolve63.f90 +++ b/flang/test/Semantics/resolve63.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Invalid operand types when user-defined operator is available module m1 type :: t diff --git a/flang/test/Semantics/resolve64.f90 b/flang/test/Semantics/resolve64.f90 index 3be2ae14fd5d..b0c2a608a4eb 100644 --- a/flang/test/Semantics/resolve64.f90 +++ b/flang/test/Semantics/resolve64.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t !OPTIONS: -flogical-abbreviations -fxor-operator ! Like m4 in resolve63 but compiled with different options. diff --git a/flang/test/Semantics/resolve65.f90 b/flang/test/Semantics/resolve65.f90 index 9e1278b66dd5..f43d70bb22c7 100644 --- a/flang/test/Semantics/resolve65.f90 +++ b/flang/test/Semantics/resolve65.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test restrictions on what subprograms can be used for defined assignment. module m1 diff --git a/flang/test/Semantics/resolve66.f90 b/flang/test/Semantics/resolve66.f90 index d54fd2bfe66c..2f2e3595786c 100644 --- a/flang/test/Semantics/resolve66.f90 +++ b/flang/test/Semantics/resolve66.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test that user-defined assignment is used in the right places module m1 diff --git a/flang/test/Semantics/resolve67.f90 b/flang/test/Semantics/resolve67.f90 index 7a8537a0a65e..883909e13936 100644 --- a/flang/test/Semantics/resolve67.f90 +++ b/flang/test/Semantics/resolve67.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test restrictions on what subprograms can be used for defined operators. ! See: 15.4.3.4.2 diff --git a/flang/test/Semantics/resolve68.f90 b/flang/test/Semantics/resolve68.f90 index 6accdafd5263..caa6f2533f98 100644 --- a/flang/test/Semantics/resolve68.f90 +++ b/flang/test/Semantics/resolve68.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Test resolution of type-bound generics. module m1 diff --git a/flang/test/Semantics/resolve69.f90 b/flang/test/Semantics/resolve69.f90 index 3bbc37e3f7aa..d5a35aa00306 100644 --- a/flang/test/Semantics/resolve69.f90 +++ b/flang/test/Semantics/resolve69.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t subroutine s1() ! C701 (R701) The type-param-value for a kind type parameter shall be a ! constant expression. diff --git a/flang/test/Semantics/resolve70.f90 b/flang/test/Semantics/resolve70.f90 index 31f33c345b63..8f805b6be72d 100644 --- a/flang/test/Semantics/resolve70.f90 +++ b/flang/test/Semantics/resolve70.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C703 (R702) The derived-type-spec shall not specify an abstract type (7.5.7). ! This constraint refers to the derived-type-spec in a type-spec. A type-spec ! can appear in an ALLOCATE statement, an ac-spec for an array constructor, and diff --git a/flang/test/Semantics/resolve71.f90 b/flang/test/Semantics/resolve71.f90 index 8c1c56fd9b0e..b4a232ebc2fa 100644 --- a/flang/test/Semantics/resolve71.f90 +++ b/flang/test/Semantics/resolve71.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C708 An entity declared with the CLASS keyword shall be a dummy argument ! or have the ALLOCATABLE or POINTER attribute. subroutine s() diff --git a/flang/test/Semantics/resolve72.f90 b/flang/test/Semantics/resolve72.f90 index 284fb2fc2055..0e7dfcbfd762 100644 --- a/flang/test/Semantics/resolve72.f90 +++ b/flang/test/Semantics/resolve72.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C709 An assumed-type entity shall be a dummy data object that does not have ! the ALLOCATABLE, CODIMENSION, INTENT (OUT), POINTER, or VALUE attribute and ! is not an explicit-shape array. diff --git a/flang/test/Semantics/resolve73.f90 b/flang/test/Semantics/resolve73.f90 index 35f8429aeacf..195f7027a2a4 100644 --- a/flang/test/Semantics/resolve73.f90 +++ b/flang/test/Semantics/resolve73.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C721 A type-param-value of * shall be used only ! * to declare a dummy argument, ! * to declare a named constant, diff --git a/flang/test/Semantics/resolve74.f90 b/flang/test/Semantics/resolve74.f90 index 60927b198769..79a1b2cec49d 100644 --- a/flang/test/Semantics/resolve74.f90 +++ b/flang/test/Semantics/resolve74.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C722 A function name shall not be declared with an asterisk type-param-value ! unless it is of type CHARACTER and is the name of a dummy function or the ! name of the result of an external function. diff --git a/flang/test/Semantics/resolve75.f90 b/flang/test/Semantics/resolve75.f90 index 708ce8ffaeec..025159d78dd4 100644 --- a/flang/test/Semantics/resolve75.f90 +++ b/flang/test/Semantics/resolve75.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C726 The length specified for a character statement function or for a ! statement function dummy argument of type character shall be a constant ! expression. diff --git a/flang/test/Semantics/resolve76.f90 b/flang/test/Semantics/resolve76.f90 index e68c81f36fb2..e5e22a99dd19 100644 --- a/flang/test/Semantics/resolve76.f90 +++ b/flang/test/Semantics/resolve76.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! 15.6.2.5(3) diff --git a/flang/test/Semantics/resolve77.f90 b/flang/test/Semantics/resolve77.f90 index 4d34ce3b8b48..efd04d975c79 100644 --- a/flang/test/Semantics/resolve77.f90 +++ b/flang/test/Semantics/resolve77.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Tests valid and invalid usage of forward references to procedures ! in specification expressions. module m diff --git a/flang/test/Semantics/resolve78.f90 b/flang/test/Semantics/resolve78.f90 index 0e4efc081009..280e1256dc55 100644 --- a/flang/test/Semantics/resolve78.f90 +++ b/flang/test/Semantics/resolve78.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m ! C743 No component-attr-spec shall appear more than once in a ! given component-def-stmt. diff --git a/flang/test/Semantics/resolve79.f90 b/flang/test/Semantics/resolve79.f90 index 5d0e2127ea10..3bac3bf30583 100644 --- a/flang/test/Semantics/resolve79.f90 +++ b/flang/test/Semantics/resolve79.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m ! C755 The same proc-component-attr-spec shall not appear more than once in a ! given proc-component-def-stmt. diff --git a/flang/test/Semantics/resolve80.f90 b/flang/test/Semantics/resolve80.f90 index 98f5c79a343b..4a196e26fc76 100644 --- a/flang/test/Semantics/resolve80.f90 +++ b/flang/test/Semantics/resolve80.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m !C778 The same binding-attr shall not appear more than once in a given !binding-attr-list. diff --git a/flang/test/Semantics/resolve81.f90 b/flang/test/Semantics/resolve81.f90 index 218d74ec6744..14f80ac9aaba 100644 --- a/flang/test/Semantics/resolve81.f90 +++ b/flang/test/Semantics/resolve81.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C801 The same attr-spec shall not appear more than once in a given ! type-declaration-stmt. ! diff --git a/flang/test/Semantics/resolve82.f90 b/flang/test/Semantics/resolve82.f90 index 378e8796db45..673abaa765ed 100644 --- a/flang/test/Semantics/resolve82.f90 +++ b/flang/test/Semantics/resolve82.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C815 An entity shall not be explicitly given any attribute more than once in ! a scoping unit. ! diff --git a/flang/test/Semantics/resolve83.f90 b/flang/test/Semantics/resolve83.f90 index cdd528a688e2..c7a4502fd6f5 100644 --- a/flang/test/Semantics/resolve83.f90 +++ b/flang/test/Semantics/resolve83.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m ! For C1543 diff --git a/flang/test/Semantics/resolve84.f90 b/flang/test/Semantics/resolve84.f90 index 79e393f4b689..06afdfc492e1 100644 --- a/flang/test/Semantics/resolve84.f90 +++ b/flang/test/Semantics/resolve84.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! C729 A derived type type-name shall not be DOUBLEPRECISION or the same as ! the name of any intrinsic type defined in this document. subroutine s() diff --git a/flang/test/Semantics/resolve85.f90 b/flang/test/Semantics/resolve85.f90 index d228b7d03e47..99391a364598 100644 --- a/flang/test/Semantics/resolve85.f90 +++ b/flang/test/Semantics/resolve85.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t module m ! C730 The same type-attr-spec shall not appear more than once in a given ! derived-type-stmt. diff --git a/flang/test/Semantics/separate-mp01.f90 b/flang/test/Semantics/separate-mp01.f90 index 305c147e66c9..b34b3500e28f 100644 --- a/flang/test/Semantics/separate-mp01.f90 +++ b/flang/test/Semantics/separate-mp01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! case 1: ma_create_new_fun' was not declared a separate module procedure module m1 diff --git a/flang/test/Semantics/separate-mp02.f90 b/flang/test/Semantics/separate-mp02.f90 index 1f514c2ccd37..823bfaca1413 100644 --- a/flang/test/Semantics/separate-mp02.f90 +++ b/flang/test/Semantics/separate-mp02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! When a module subprogram has the MODULE prefix the following must match ! with the corresponding separate module procedure interface body: diff --git a/flang/test/Semantics/stop01.f90 b/flang/test/Semantics/stop01.f90 index 2ae8d65a84bb..69c5ad83e481 100644 --- a/flang/test/Semantics/stop01.f90 +++ b/flang/test/Semantics/stop01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t program main implicit none integer :: i = -1 diff --git a/flang/test/Semantics/structconst01.f90 b/flang/test/Semantics/structconst01.f90 index 68f0261cd85d..cdd2e77a506a 100644 --- a/flang/test/Semantics/structconst01.f90 +++ b/flang/test/Semantics/structconst01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Error tests for structure constructors. ! Errors caught by name resolution are tested elsewhere; these are the ! errors meant to be caught by expression semantic analysis, as well as diff --git a/flang/test/Semantics/structconst02.f90 b/flang/test/Semantics/structconst02.f90 index 22428651fa1c..a309b02e8fe0 100644 --- a/flang/test/Semantics/structconst02.f90 +++ b/flang/test/Semantics/structconst02.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Error tests for structure constructors: per-component type ! (in)compatibility. diff --git a/flang/test/Semantics/structconst03.f90 b/flang/test/Semantics/structconst03.f90 index 776b4d082309..01d40720e771 100644 --- a/flang/test/Semantics/structconst03.f90 +++ b/flang/test/Semantics/structconst03.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Error tests for structure constructors: C1594 violations ! from assigning globally-visible data to POINTER components. ! test/Semantics/structconst04.f90 is this same test without type diff --git a/flang/test/Semantics/structconst04.f90 b/flang/test/Semantics/structconst04.f90 index 07a9d69df868..3f0b21c6d5ec 100644 --- a/flang/test/Semantics/structconst04.f90 +++ b/flang/test/Semantics/structconst04.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %flang %t +! RUN: %B/test/Semantics/test_errors.sh %s %flang %t ! Error tests for structure constructors: C1594 violations ! from assigning globally-visible data to POINTER components. ! This test is structconst03.f90 with the type parameters removed. diff --git a/flang/test/Semantics/test_any.sh b/flang/test/Semantics/test_any.sh index b0735935928f..19fa22f1574d 100755 --- a/flang/test/Semantics/test_any.sh +++ b/flang/test/Semantics/test_any.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#/usr/bin/env bash # Compile a source file with '-funparse-with-symbols' and verify # we get the right symbols in the output, i.e. the output should be # the same as the input, except for the copyright comment. @@ -7,7 +7,7 @@ srcdir=$(dirname $0) source $srcdir/common.sh -FileCheck=${FileCheck:=internal_check} +FileCheck=internal_check function internal_check() { r=true diff --git a/flang/test/Semantics/test_errors.sh b/flang/test/Semantics/test_errors.sh.in similarity index 93% rename from flang/test/Semantics/test_errors.sh rename to flang/test/Semantics/test_errors.sh.in index 9fcb06b03320..535ded3882bf 100755 --- a/flang/test/Semantics/test_errors.sh +++ b/flang/test/Semantics/test_errors.sh.in @@ -3,7 +3,7 @@ # Change the compiler by setting the F18 environment variable. F18_OPTIONS="-fdebug-resolve-names -fparse-only" -srcdir=$(dirname $0) +srcdir="@CMAKE_CURRENT_SOURCE_DIR@" source $srcdir/common.sh [[ ! -f $src ]] && die "File not found: $src" @@ -12,7 +12,7 @@ actual=$temp/actual expect=$temp/expect diffs=$temp/diffs -include=$(dirname $(dirname $F18))/include +include="@FLANG_INTRINSIC_MODULES_DIR@" cmd="$F18 $F18_OPTIONS $USER_OPTIONS -I$include $src" ( cd $temp; $cmd ) > $log 2>&1 if [[ $? -ge 128 ]]; then diff --git a/flang/test/lit.cfg.py b/flang/test/lit.cfg.py index 57dc7383d88b..439f9710ef66 100644 --- a/flang/test/lit.cfg.py +++ b/flang/test/lit.cfg.py @@ -54,6 +54,8 @@ if config.flang_llvm_tools_dir != "" : if config.llvm_tools_dir != config.flang_llvm_tools_dir : llvm_config.with_environment('PATH', config.flang_llvm_tools_dir, append_path=True) +config.substitutions.append(('%B', config.flang_obj_root)) + # For each occurrence of a flang tool name, replace it with the full path to # the build directory holding that tool. We explicitly specify the directories # to search to ensure that we get the tools just built and not some random @@ -71,4 +73,4 @@ llvm_config.add_tool_substitutions(tools, tool_dirs) # Enable libpgmath testing result = lit_config.params.get("LIBPGMATH") if result: - config.environment["LIBPGMATH"] = True \ No newline at end of file + config.environment["LIBPGMATH"] = True diff --git a/flang/tools/CMakeLists.txt b/flang/tools/CMakeLists.txt index a02679436d14..b973127d3443 100644 --- a/flang/tools/CMakeLists.txt +++ b/flang/tools/CMakeLists.txt @@ -10,3 +10,4 @@ add_subdirectory(f18) if(LINK_WITH_FIR) add_subdirectory(tco) endif() +add_subdirectory(f18-parse-demo) diff --git a/flang/tools/f18-parse-demo/CMakeLists.txt b/flang/tools/f18-parse-demo/CMakeLists.txt new file mode 100644 index 000000000000..fc64a3f0d904 --- /dev/null +++ b/flang/tools/f18-parse-demo/CMakeLists.txt @@ -0,0 +1,13 @@ +add_llvm_tool(f18-parse-demo + f18-parse-demo.cpp + stub-evaluate.cpp + ) +set_property(TARGET f18-parse-demo PROPERTY CXX_STANDARD 17) +target_compile_features(f18-parse-demo PRIVATE cxx_std_17) + +target_link_libraries(f18-parse-demo + PRIVATE + FortranParser + ) + +#install(TARGETS f18-parse-demo DESTINATION bin) diff --git a/flang/tools/f18/f18-parse-demo.cpp b/flang/tools/f18-parse-demo/f18-parse-demo.cpp similarity index 100% rename from flang/tools/f18/f18-parse-demo.cpp rename to flang/tools/f18-parse-demo/f18-parse-demo.cpp diff --git a/flang/tools/f18/stub-evaluate.cpp b/flang/tools/f18-parse-demo/stub-evaluate.cpp similarity index 100% rename from flang/tools/f18/stub-evaluate.cpp rename to flang/tools/f18-parse-demo/stub-evaluate.cpp diff --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt index b2f8e129e83a..8745f7c1caef 100644 --- a/flang/tools/f18/CMakeLists.txt +++ b/flang/tools/f18/CMakeLists.txt @@ -1,20 +1,12 @@ -#===-- tools/f18/CMakeLists.txt --------------------------------------------===# -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===------------------------------------------------------------------------===# - -file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin") -file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include") - -add_executable(f18 - f18.cpp +add_llvm_tool(f18 dump.cpp + f18.cpp ) +set_property(TARGET f18 PROPERTY CXX_STANDARD 17) +target_compile_features(f18 PRIVATE cxx_std_17) target_link_libraries(f18 + PRIVATE FortranParser FortranEvaluate FortranSemantics @@ -22,20 +14,6 @@ target_link_libraries(f18 LLVMSupport ) -add_executable(f18-parse-demo - f18-parse-demo.cpp - stub-evaluate.cpp -) - -target_link_libraries(f18-parse-demo - FortranParser -) - -set_target_properties(f18 f18-parse-demo - PROPERTIES - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin" -) - set(MODULES "ieee_arithmetic" "ieee_exceptions" @@ -46,7 +24,9 @@ set(MODULES "__fortran_builtins" ) -set(include ${CMAKE_CURRENT_BINARY_DIR}/include) +set(include ${FLANG_BINARY_DIR}/include/flang) + +set(include ${FLANG_BINARY_DIR}/include/flang) # Create module files directly from the top-level module source directory foreach(filename ${MODULES}) @@ -57,9 +37,9 @@ foreach(filename ${MODULES}) endif() add_custom_command(OUTPUT ${include}/${filename}.mod COMMAND f18 -fparse-only -I${include} - ${PROJECT_SOURCE_DIR}/module/${filename}.f90 + ${FLANG_SOURCE_DIR}/module/${filename}.f90 WORKING_DIRECTORY ${include} - DEPENDS f18 ${PROJECT_SOURCE_DIR}/module/${filename}.f90 ${depends} + DEPENDS f18 ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${depends} ) add_custom_command(OUTPUT ${include}/${filename}.f18.mod DEPENDS ${include}/${filename}.mod @@ -67,21 +47,19 @@ foreach(filename ${MODULES}) copy ${include}/${filename}.mod ${include}/${filename}.f18.mod) list(APPEND MODULE_FILES ${include}/${filename}.mod) list(APPEND MODULE_FILES ${include}/${filename}.f18.mod) - install(FILES ${include}/${filename}.mod DESTINATION include) - install(FILES ${include}/${filename}.f18.mod DESTINATION include) + install(FILES ${include}/${filename}.mod DESTINATION include/flang) + install(FILES ${include}/${filename}.f18.mod DESTINATION include/flang) endforeach() add_custom_target(module_files ALL DEPENDS ${MODULE_FILES}) -install(TARGETS f18 f18-parse-demo DESTINATION bin) +install(TARGETS f18 DESTINATION bin) -file(COPY flang.sh - DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/bin" - FILE_PERMISSIONS - OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE -) -file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/bin/flang.sh" "${CMAKE_CURRENT_BINARY_DIR}/bin/flang") +set(FLANG_INTRINSIC_MODULES_DIR ${FLANG_BINARY_DIR}/include/flang) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/flang.sh.in ${CMAKE_BINARY_DIR}/tools/flang/bin/flang @ONLY) +file(COPY ${CMAKE_BINARY_DIR}/tools/flang/bin/flang DESTINATION ${CMAKE_BINARY_DIR}/bin FILE_PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE) +# The flang script to be installed needs a different path to the headers. +set(FLANG_INTRINSIC_MODULES_DIR ${CMAKE_INSTALL_PREFIX}/include/flang) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/flang.sh.in ${FLANG_BINARY_DIR}/bin/flang-install.sh @ONLY) -install(PROGRAMS flang.sh DESTINATION bin RENAME flang) +install(PROGRAMS ${FLANG_BINARY_DIR}/bin/flang-install.sh DESTINATION bin RENAME flang PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE) diff --git a/flang/tools/f18/flang.sh b/flang/tools/f18/flang.sh.in similarity index 95% rename from flang/tools/f18/flang.sh rename to flang/tools/f18/flang.sh.in index bf37e99f4d22..7f0d1335aec4 100644 --- a/flang/tools/f18/flang.sh +++ b/flang/tools/f18/flang.sh.in @@ -26,4 +26,4 @@ function abspath() { wd=`abspath $(dirname "$0")/..` -${wd}/bin/f18 -module-suffix .f18.mod -intrinsic-module-directory ${wd}/include $* +${wd}/bin/f18 -module-suffix .f18.mod -intrinsic-module-directory @FLANG_INTRINSIC_MODULES_DIR@ $* diff --git a/flang/unittests/CMakeLists.txt b/flang/unittests/CMakeLists.txt index 6d49e6c72b57..2171927aa104 100644 --- a/flang/unittests/CMakeLists.txt +++ b/flang/unittests/CMakeLists.txt @@ -1,11 +1,3 @@ -#===-- test/CMakeLists.txt -------------------------------------------------===# -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===------------------------------------------------------------------------===# - add_subdirectory(Decimal) add_subdirectory(Evaluate) add_subdirectory(Runtime) diff --git a/flang/unittests/Decimal/CMakeLists.txt b/flang/unittests/Decimal/CMakeLists.txt index 780c92e74475..f26aca5d0e9b 100644 --- a/flang/unittests/Decimal/CMakeLists.txt +++ b/flang/unittests/Decimal/CMakeLists.txt @@ -1,11 +1,4 @@ -#===-- test/Decimal/CMakeLists.txt -----------------------------------------===# -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===------------------------------------------------------------------------===# - +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) add_executable(quick-sanity-test quick-sanity-test.cpp ) @@ -24,4 +17,4 @@ target_link_libraries(thorough-test LLVMSupport ) -add_test(Sanity quick-sanity-test) +add_test(NAME Sanity COMMAND quick-sanity-test) diff --git a/flang/unittests/Evaluate/CMakeLists.txt b/flang/unittests/Evaluate/CMakeLists.txt index fb195ae5730a..54c816ef6c55 100644 --- a/flang/unittests/Evaluate/CMakeLists.txt +++ b/flang/unittests/Evaluate/CMakeLists.txt @@ -1,11 +1,4 @@ -#===-- test/Evaluate/CMakeLists.txt ----------------------------------------===# -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#===------------------------------------------------------------------------===# - +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) add_library(FortranEvaluateTesting testing.cpp fp-testing.cpp diff --git a/flang/unittests/Runtime/CMakeLists.txt b/flang/unittests/Runtime/CMakeLists.txt index 3f73b79132f9..a5297ac67821 100644 --- a/flang/unittests/Runtime/CMakeLists.txt +++ b/flang/unittests/Runtime/CMakeLists.txt @@ -1,18 +1,11 @@ -#===-- test/Runtime/CMakeLists.txt -----------------------------------------===# -# -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# -#------------------------------------------------------------------------------# - if(CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") endif() +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) add_library(RuntimeTesting testing.cpp -) + ) add_executable(format-test format.cpp @@ -24,7 +17,7 @@ target_link_libraries(format-test LLVMSupport ) -add_test(Format format-test) +add_test(NAME Format COMMAND format-test) add_executable(hello-world hello.cpp @@ -36,7 +29,7 @@ target_link_libraries(hello-world LLVMSupport ) -add_test(HelloWorld hello-world) +add_test(NAME HelloWorld COMMAND hello-world) add_executable(external-hello-world external-hello.cpp @@ -49,7 +42,7 @@ target_link_libraries(external-hello-world add_executable(list-input-test list-input.cpp -) + ) target_link_libraries(list-input-test FortranRuntime @@ -57,4 +50,4 @@ target_link_libraries(list-input-test LLVMSupport ) -add_test(ListInput list-input-test) +add_test(NAME ListInput COMMAND list-input-test)