From ad3adbdaa40329345dd8005a772a582f286cf45f Mon Sep 17 00:00:00 2001 From: Alex Guteniev Date: Thu, 23 Apr 2020 17:27:24 +0300 Subject: [PATCH] Fix #739 (without saving stack variable) --- stl/inc/atomic | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stl/inc/atomic b/stl/inc/atomic index 886a69d0b5..de4068477f 100644 --- a/stl/inc/atomic +++ b/stl/inc/atomic @@ -1942,8 +1942,8 @@ extern "C" inline void atomic_thread_fence(const memory_order _Order) noexcept { #else // ^^^ ARM32/ARM64 hardware / x86/x64 hardware vvv _Compiler_barrier(); if (_Order == memory_order_seq_cst) { - static long _Guard; - (void) _InterlockedCompareExchange(&_Guard, 0, 0); + volatile long _Guard; + (void) _InterlockedExchange(&_Guard, 0); _Compiler_barrier(); } #endif // hardware