This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Fix gfortran bugzilla build bug 41755
ClosedPublic

Authored by jlpeyton on May 6 2019, 10:58 AM.

Details

Summary

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

Diff Detail

Repository
rL LLVM

Event Timeline

jlpeyton created this revision.May 6 2019, 10:58 AM
Hahnfeld added inline comments.
runtime/src/CMakeLists.txt
242–244 ↗(On Diff #198306)

I think this should be CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" if I finally understood variable expansion in its full glory from what we discussed in many other revisions. (Yeah, many places are still wrong, but we can start by not making it worse.)

Do we need a configure check that this flag is indeed available? Just thinking, but it seems that GCC has this flag since ages, even in 4.8.5. So maybe that's just unnecessary work.

In any case, please add a comment explaining that this is to workaround a bug in GCC (if I read the bug and @AndreyChurbanov's explanation correctly).

jlpeyton updated this revision to Diff 198332.May 6 2019, 1:36 PM

Added comment and removed the variable expansion for CMAKE_Fortran_COMPILER_ID

I don't think we need to check for the flag since llvm requires gcc >= 5.1 and OpenMP runtime by itself requires 4.8.x.

This revision is now accepted and ready to land.May 8 2019, 3:54 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 8 2019, 4:10 PM