Blame SOURCES/fix-strict-aliasing-issue-in-cmpxchg-routine.patch

84b4fd
diff --git a/openmp/runtime/src/kmp_os.h b/openmp/runtime/src/kmp_os.h
84b4fd
--- a/openmp/runtime/src/kmp_os.h
84b4fd
+++ b/openmp/runtime/src/kmp_os.h
84b4fd
@@ -17,6 +17,7 @@
84b4fd
 #include <atomic>
84b4fd
 #include <stdarg.h>
84b4fd
 #include <stdlib.h>
84b4fd
+#include <string.h>
84b4fd
 
84b4fd
 #define KMP_FTN_PLAIN 1
84b4fd
 #define KMP_FTN_APPEND 2
84b4fd
@@ -864,15 +865,25 @@
84b4fd
   __sync_lock_test_and_set((volatile kmp_uint64 *)(p), (kmp_uint64)(v))
84b4fd
 
84b4fd
 inline kmp_real32 KMP_XCHG_REAL32(volatile kmp_real32 *p, kmp_real32 v) {
84b4fd
-  kmp_int32 tmp =
84b4fd
-      __sync_lock_test_and_set((volatile kmp_uint32 *)(p), *(kmp_uint32 *)&v);
84b4fd
-  return *(kmp_real32 *)&tm;;
84b4fd
+  volatile kmp_uint32 *up;
84b4fd
+  kmp_uint32 uv;
84b4fd
+  memcpy(&up, &p, sizeof(up));
84b4fd
+  memcpy(&uv, &v, sizeof(uv));
84b4fd
+  kmp_int32 tmp = __sync_lock_test_and_set(up, uv);
84b4fd
+  kmp_real32 ftmp;
84b4fd
+  memcpy(&ftmp, &tmp, sizeof(tmp));
84b4fd
+  return ftmp;
84b4fd
 }
84b4fd
 
84b4fd
 inline kmp_real64 KMP_XCHG_REAL64(volatile kmp_real64 *p, kmp_real64 v) {
84b4fd
-  kmp_int64 tmp =
84b4fd
-      __sync_lock_test_and_set((volatile kmp_uint64 *)(p), *(kmp_uint64 *)&v);
84b4fd
-  return *(kmp_real64 *)&tm;;
84b4fd
+  volatile kmp_uint64 *up;
84b4fd
+  kmp_uint64 uv;
84b4fd
+  memcpy(&up, &p, sizeof(up));
84b4fd
+  memcpy(&uv, &v, sizeof(uv));
84b4fd
+  kmp_int64 tmp = __sync_lock_test_and_set(up, uv);
84b4fd
+  kmp_real64 dtmp;
84b4fd
+  memcpy(&dtmp, &tmp, sizeof(tmp));
84b4fd
+  return dtmp;
84b4fd
 }
84b4fd
 
84b4fd
 #else
84b4fd