0

clang/win: Prevent clang from optimizing away a malloc in a test.

Similar to e.g. https://codereview.chromium.org/8429008 and
https://codereview.chromium.org/8429008 .

BUG=448935
R=scottmg@chromium.org, wfh@chromium.org

Review URL: https://codereview.chromium.org/868743003

Cr-Commit-Position: refs/heads/master@{#312673}
This commit is contained in:
Nico Weber
2015-01-22 12:35:36 -08:00
parent ff21476a27
commit 33fd64cf5b

@@ -42,7 +42,8 @@ int OnNoMemory(size_t) {
void ExhaustMemoryWithMalloc() {
for (;;) {
void* buf = malloc(kLargePermittedAllocation);
// Without the |volatile|, clang optimizes away the allocation.
void* volatile buf = malloc(kLargePermittedAllocation);
if (!buf)
break;
}