From df64d523104d05a17c9ef66345077154588a5424 Mon Sep 17 00:00:00 2001 From: Shu-Chun Weng Date: Mon, 3 May 2021 16:12:44 -0700 Subject: [PATCH] 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. --- string/tst-xbzero-opt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/string/tst-xbzero-opt.c b/string/tst-xbzero-opt.c index e9c411b2ef5..4f16c4d6784 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 -- 2.47.2