From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2082) id 88E9E385BF84; Thu, 15 Jul 2021 19:42:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 88E9E385BF84 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Shu-Chun Weng To: glibc-cvs@sourceware.org Subject: [glibc/google/grte/v5-2.27/master] More aggressively prevent a buffer from being optimized out X-Act-Checkin: glibc X-Git-Author: Shu-Chun Weng X-Git-Refname: refs/heads/google/grte/v5-2.27/master X-Git-Oldrev: 7ffbf1d93ce834ab249ed7569cdce344eaf5bc84 X-Git-Newrev: 7903140dcc2b36c4eadae7132fb51a4463fd134e Message-Id: <20210715194247.88E9E385BF84@sourceware.org> Date: Thu, 15 Jul 2021 19:42:47 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 19:42:47 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7903140dcc2b36c4eadae7132fb51a4463fd134e commit 7903140dcc2b36c4eadae7132fb51a4463fd134e Author: Shu-Chun Weng Date: Mon May 3 16:12:44 2021 -0700 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: --- 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 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