[Openmp-commits] [PATCH] D61603: [OpenMP] Fix gfortran bugzilla build bug 41755

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon May 6 10:58:51 PDT 2019


jlpeyton created this revision.
jlpeyton added reviewers: jdoerfert, AndreyChurbanov.
jlpeyton added a project: OpenMP.
Herald added subscribers: guansong, mgorny.

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


Repository:
  rOMP OpenMP

https://reviews.llvm.org/D61603

Files:
  runtime/src/CMakeLists.txt


Index: runtime/src/CMakeLists.txt
===================================================================
--- runtime/src/CMakeLists.txt
+++ runtime/src/CMakeLists.txt
@@ -239,6 +239,9 @@
   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)
+  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 +251,8 @@
   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
   )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61603.198306.patch
Type: text/x-patch
Size: 1131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20190506/eccbee3b/attachment.bin>


More information about the Openmp-commits mailing list