diff options
author | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2019-05-08 23:12:31 +0000 |
---|---|---|
committer | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2019-05-08 23:12:31 +0000 |
commit | c107332583152ab61b870aee29ecd31a938fa676 (patch) | |
tree | 7d0beb9c0f80e6d3857a8e86c163bab22f208028 | |
parent | fad8fb8032032e0609ad553b6498a79dad96a54d (diff) | |
download | bcm5719-llvm-c107332583152ab61b870aee29ecd31a938fa676.tar.gz bcm5719-llvm-c107332583152ab61b870aee29ecd31a938fa676.zip |
[OpenMP] Workaround gfortran bugzilla build bug 41755
This patch provides workaround to allow gfortran to compile the
OpenMP Fortran modules.
From the gfortran manual:
https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gfortran/BOZ-literal-constants.html
"Note that initializing an INTEGER variable with a statement such as
DATA i/Z'FFFFFFFF'/ will give an integer overflow error rather than the desired
result of -1 when i is a 32-bit integer on a system that supports 64-bit
integers. The -fno-range-check option can be used as a workaround for legacy
code that initializes integers in this manner."
Bug filed: https://bugs.llvm.org/show_bug.cgi?id=41755
Differential Revision: https://reviews.llvm.org/D61603
llvm-svn: 360299
-rw-r--r-- | openmp/runtime/src/CMakeLists.txt | 8 | ||||
-rw-r--r-- | openmp/runtime/src/include/50/omp_lib.f90.var | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt index efa9e1f5a9f..28d0acee7f6 100644 --- a/openmp/runtime/src/CMakeLists.txt +++ b/openmp/runtime/src/CMakeLists.txt @@ -239,6 +239,11 @@ if(${LIBOMP_FORTRAN_MODULES}) configure_file(${LIBOMP_INC_DIR}/omp_lib.h.var omp_lib.h @ONLY) configure_file(${LIBOMP_INC_DIR}/omp_lib.f.var omp_lib.f @ONLY) configure_file(${LIBOMP_INC_DIR}/omp_lib.f90.var omp_lib.f90 @ONLY) + # Workaround for gfortran to build modules with the + # omp_sched_monotonic integer parameter + if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") + set(ADDITIONAL_Fortran_FLAGS "-fno-range-check") + endif() add_custom_target(libomp-mod ALL DEPENDS omp_lib.mod omp_lib_kinds.mod) libomp_get_fflags(LIBOMP_CONFIGURED_FFLAGS) if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) @@ -248,7 +253,8 @@ if(${LIBOMP_FORTRAN_MODULES}) endif() add_custom_command( OUTPUT omp_lib.mod omp_lib_kinds.mod - COMMAND ${CMAKE_Fortran_COMPILER} -c ${LIBOMP_CONFIGURED_FFLAGS} ${LIBOMP_FORTRAN_SOURCE_FILE} + COMMAND ${CMAKE_Fortran_COMPILER} -c ${ADDITIONAL_Fortran_FLAGS} + ${LIBOMP_CONFIGURED_FFLAGS} ${LIBOMP_FORTRAN_SOURCE_FILE} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${LIBOMP_FORTRAN_SOURCE_FILE} ${CMAKE_CURRENT_BINARY_DIR}/omp_lib.h ) diff --git a/openmp/runtime/src/include/50/omp_lib.f90.var b/openmp/runtime/src/include/50/omp_lib.f90.var index cef6f332c27..a971577e39c 100644 --- a/openmp/runtime/src/include/50/omp_lib.f90.var +++ b/openmp/runtime/src/include/50/omp_lib.f90.var @@ -59,7 +59,7 @@ integer(kind=omp_sched_kind), parameter :: omp_sched_dynamic = 2 integer(kind=omp_sched_kind), parameter :: omp_sched_guided = 3 integer(kind=omp_sched_kind), parameter :: omp_sched_auto = 4 - integer(kind=omp_sched_kind), parameter :: omp_sched_monotonic = Z'80000000' + integer(kind=omp_sched_kind), parameter :: omp_sched_monotonic = int(Z'80000000', kind=omp_sched_kind) integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_false = 0 integer (kind=omp_proc_bind_kind), parameter :: omp_proc_bind_true = 1 |