summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2015-11-11 17:48:49 -0800
committerJan Kotas <jkotas@microsoft.com>2015-11-11 17:48:49 -0800
commit5c87fd284a02eb089ce2af7fe9d757d2c1fa5a36 (patch)
tree992c2591b073050821df49210033099c9ead7e17 /src
parent077d5cb53bf9c0339cca6e2dc64e1d523987098d (diff)
downloadcoreclr-5c87fd284a02eb089ce2af7fe9d757d2c1fa5a36.tar.gz
coreclr-5c87fd284a02eb089ce2af7fe9d757d2c1fa5a36.tar.bz2
coreclr-5c87fd284a02eb089ce2af7fe9d757d2c1fa5a36.zip
Use volatile store for g_hrFatalError
Diffstat (limited to 'src')
-rw-r--r--src/utilcode/ex.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/utilcode/ex.cpp b/src/utilcode/ex.cpp
index d3e0393a16..e692e130be 100644
--- a/src/utilcode/ex.cpp
+++ b/src/utilcode/ex.cpp
@@ -1698,7 +1698,8 @@ void DECLSPEC_NORETURN ThrowOutOfMemory()
#ifndef DACCESS_COMPILE
- g_hrFatalError = COR_E_OUTOFMEMORY;
+ // Use volatile store to prevent compiler from optimizing the static variable away
+ VolatileStoreWithoutBarrier<HRESULT>(&g_hrFatalError, COR_E_OUTOFMEMORY);
// Regular CLR builds - throw our pre-created OOM exception object
PAL_CPP_THROW(Exception *, Exception::GetOOMException());