summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShu-Chun Weng <scw@google.com>2021-05-03 16:12:44 -0700
committerFangrui Song <i@maskray.me>2021-08-27 17:26:06 -0700
commitdf64d523104d05a17c9ef66345077154588a5424 (patch)
tree267825fc544f193c8812c17c9592a766e7df80ee
parenta21d58a0dcd816bd97b9de328ad1870cc7098d9b (diff)
downloadglibc-df64d523104d05a17c9ef66345077154588a5424.tar.gz
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.
-rw-r--r--string/tst-xbzero-opt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/string/tst-xbzero-opt.c b/string/tst-xbzero-opt.c
index e9c411b2ef..4f16c4d678 100644
--- a/string/tst-xbzero-opt.c
+++ b/string/tst-xbzero-opt.c
@@ -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