diff options
author | Jan Kotas <jkotas@microsoft.com> | 2015-11-11 17:48:49 -0800 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2015-11-11 17:48:49 -0800 |
commit | 5c87fd284a02eb089ce2af7fe9d757d2c1fa5a36 (patch) | |
tree | 992c2591b073050821df49210033099c9ead7e17 /src/utilcode | |
parent | 077d5cb53bf9c0339cca6e2dc64e1d523987098d (diff) | |
download | coreclr-5c87fd284a02eb089ce2af7fe9d757d2c1fa5a36.tar.gz coreclr-5c87fd284a02eb089ce2af7fe9d757d2c1fa5a36.tar.bz2 coreclr-5c87fd284a02eb089ce2af7fe9d757d2c1fa5a36.zip |
Use volatile store for g_hrFatalError
Diffstat (limited to 'src/utilcode')
-rw-r--r-- | src/utilcode/ex.cpp | 3 |
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()); |