aboutsummaryrefslogtreecommitdiff
path: root/string
diff options
context:
space:
mode:
authorStan Shebs <stanshebs@google.com>2018-05-09 11:26:35 -0700
committerStan Shebs <stanshebs@google.com>2018-05-09 11:26:35 -0700
commit40513af8adceabbfbfd7c64631c0fb6e57373c23 (patch)
treead966a99268528c474077f95c17d800badda1425 /string
parent903b7aed7c0122c37f5c5fe93a20a92f5274b10a (diff)
downloadglibc-40513af8adceabbfbfd7c64631c0fb6e57373c23.zip
glibc-40513af8adceabbfbfd7c64631c0fb6e57373c23.tar.gz
glibc-40513af8adceabbfbfd7c64631c0fb6e57373c23.tar.bz2
Forestall optimization-out of a buffer.
Diffstat (limited to 'string')
-rw-r--r--string/tst-xbzero-opt.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/string/tst-xbzero-opt.c b/string/tst-xbzero-opt.c
index cf7041f..e9c411b 100644
--- a/string/tst-xbzero-opt.c
+++ b/string/tst-xbzero-opt.c
@@ -110,11 +110,17 @@ prepare_test_buffer (unsigned char *buf)
abort ();
}
+/* Use a volatile global to ensure that aggressive compilers don't
+ decide that the test buffer is unused and evaporate it. */
+
+volatile unsigned char *vol_glob;
+
static void
setup_no_clear (void)
{
unsigned char buf[TEST_BUFFER_SIZE];
prepare_test_buffer (buf);
+ vol_glob = buf;
}
static void
@@ -123,6 +129,7 @@ setup_ordinary_clear (void)
unsigned char buf[TEST_BUFFER_SIZE];
prepare_test_buffer (buf);
memset (buf, 0, TEST_BUFFER_SIZE);
+ vol_glob = buf;
}
static void