More aggressively prevent a buffer from being optimized out

The volatile global variable was first introduced in e86f9654c. I have
noticed the compiler still optimizing the buffer out on AArch64
presumably because the assignment is after all other observable
behaviors so it's still valid to eliminate it.
This commit is contained in:
Shu-Chun Weng 2021-05-03 16:12:44 -07:00 committed by Fangrui Song
parent a21d58a0dc
commit df64d52310

View File

@ -119,17 +119,17 @@ static void
setup_no_clear (void)
{
unsigned char buf[TEST_BUFFER_SIZE];
prepare_test_buffer (buf);
vol_glob = buf;
prepare_test_buffer (buf);
}
static void
setup_ordinary_clear (void)
{
unsigned char buf[TEST_BUFFER_SIZE];
vol_glob = buf;
prepare_test_buffer (buf);
memset (buf, 0, TEST_BUFFER_SIZE);
vol_glob = buf;
}
static void