+2018-07-26 Stefan Liebler <stli@linux.ibm.com>
+
+ * string/tst-xbzero-opt.c (use_test_buffer): New function.
+ (prepare_test_buffer): Call use_test_buffer as compiler barrier.
+
2018-07-26 Florian Weimer <fweimer@redhat.com>
* htl/lockfile.c (flockfile, funlockfile, ftrylockfile): Use weak
static ucontext_t uc_main, uc_co;
+static __attribute__ ((noinline, noclone)) int
+use_test_buffer (unsigned char *buf)
+{
+ unsigned int sum = 0;
+
+ for (unsigned int i = 0; i < PATTERN_REPS; i++)
+ sum += buf[i * PATTERN_SIZE];
+
+ return (sum == 2 * PATTERN_REPS) ? 0 : 1;
+}
+
/* Always check the test buffer immediately after filling it; this
makes externally visible side effects depend on the buffer existing
and having been filled in. */
if (swapcontext (&uc_co, &uc_main))
abort ();
+
+ /* Force the compiler to really copy the pattern to buf. */
+ if (use_test_buffer (buf))
+ abort ();
}
static void