From 84b4fd4e5e955f96050ca2705c3f21c1fc593cd1 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: May 19 2022 10:23:40 +0000 Subject: import libomp-14.0.0-2.module+el8.7.0+15272+f8692459 --- diff --git a/SOURCES/fix-strict-aliasing-issue-in-cmpxchg-routine.patch b/SOURCES/fix-strict-aliasing-issue-in-cmpxchg-routine.patch new file mode 100644 index 0000000..db6ca9c --- /dev/null +++ b/SOURCES/fix-strict-aliasing-issue-in-cmpxchg-routine.patch @@ -0,0 +1,44 @@ +diff --git a/openmp/runtime/src/kmp_os.h b/openmp/runtime/src/kmp_os.h +--- a/openmp/runtime/src/kmp_os.h ++++ b/openmp/runtime/src/kmp_os.h +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + + #define KMP_FTN_PLAIN 1 + #define KMP_FTN_APPEND 2 +@@ -864,15 +865,25 @@ + __sync_lock_test_and_set((volatile kmp_uint64 *)(p), (kmp_uint64)(v)) + + inline kmp_real32 KMP_XCHG_REAL32(volatile kmp_real32 *p, kmp_real32 v) { +- kmp_int32 tmp = +- __sync_lock_test_and_set((volatile kmp_uint32 *)(p), *(kmp_uint32 *)&v); +- return *(kmp_real32 *)&tmp; ++ volatile kmp_uint32 *up; ++ kmp_uint32 uv; ++ memcpy(&up, &p, sizeof(up)); ++ memcpy(&uv, &v, sizeof(uv)); ++ kmp_int32 tmp = __sync_lock_test_and_set(up, uv); ++ kmp_real32 ftmp; ++ memcpy(&ftmp, &tmp, sizeof(tmp)); ++ return ftmp; + } + + inline kmp_real64 KMP_XCHG_REAL64(volatile kmp_real64 *p, kmp_real64 v) { +- kmp_int64 tmp = +- __sync_lock_test_and_set((volatile kmp_uint64 *)(p), *(kmp_uint64 *)&v); +- return *(kmp_real64 *)&tmp; ++ volatile kmp_uint64 *up; ++ kmp_uint64 uv; ++ memcpy(&up, &p, sizeof(up)); ++ memcpy(&uv, &v, sizeof(uv)); ++ kmp_int64 tmp = __sync_lock_test_and_set(up, uv); ++ kmp_real64 dtmp; ++ memcpy(&dtmp, &tmp, sizeof(tmp)); ++ return dtmp; + } + + #else + diff --git a/SPECS/libomp.spec b/SPECS/libomp.spec index 8912361..a72dfaa 100644 --- a/SPECS/libomp.spec +++ b/SPECS/libomp.spec @@ -11,7 +11,7 @@ Name: libomp Version: %{libomp_version}%{?rc_ver:~rc%{rc_ver}} -Release: 1%{?dist} +Release: 2%{?dist} Summary: OpenMP runtime for clang License: NCSA @@ -27,6 +27,8 @@ Patch0: 0001-PATCH-openmp-CMake-Make-LIBOMP_HEADERS_INSTALL_PATH-.patch # the kmp_lock.cpp. Without this patch, GCC errors out with # ../runtime/src/kmp_lock.cpp:2684:1: error: unsupported size for integer register Patch1: gcc-workaround.patch +# https://github.com/llvm/llvm-project/commit/40d3a0ba4d9e5452c0a68cfdaa8e88eb8ed5c63d +Patch2: fix-strict-aliasing-issue-in-cmpxchg-routine.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -166,6 +168,10 @@ cd %{_vpath_builddir} %{_libexecdir}/tests/libomp/ %changelog +* Wed May 18 2022 Timm Bäder - 14.00-2 +- Backport 40d3a0ba4d9e5452c0a68cfdaa8e88eb8ed5c63d to + fix a strict aliasing issue. + * Thu Apr 07 2022 Timm Bäder - 14.0.0-1 - Update to 14.0.0