From: Shu-Chun Weng Date: Mon, 3 May 2021 23:12:44 +0000 (-0700) Subject: More aggressively prevent a buffer from being optimized out X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=df64d523104d05a17c9ef66345077154588a5424;p=thirdparty%2Fglibc.git 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. --- 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