summaryrefslogtreecommitdiff
path: root/src/vm/object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vm/object.cpp')
-rw-r--r--src/vm/object.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/vm/object.cpp b/src/vm/object.cpp
index 3e3f6d1..4c08f02 100644
--- a/src/vm/object.cpp
+++ b/src/vm/object.cpp
@@ -2954,8 +2954,9 @@ void __fastcall ZeroMemoryInGCHeap(void* mem, size_t size)
*memBytes++ = 0;
// now write pointer sized pieces
+ // volatile ensures that this doesn't get optimized back into a memset call (see #12207)
size_t nPtrs = (endBytes - memBytes) / sizeof(PTR_PTR_VOID);
- PTR_PTR_VOID memPtr = (PTR_PTR_VOID) memBytes;
+ volatile PTR_PTR_VOID memPtr = (PTR_PTR_VOID) memBytes;
for (size_t i = 0; i < nPtrs; i++)
*memPtr++ = 0;