Fix string/tst-xbzero-opt if build with gcc head.
Zack Weinberg
zackw@panix.com
Thu Jul 12 16:42:00 GMT 2018
On Thu, Jul 12, 2018 at 10:22 AM, Stefan Liebler <stli@linux.ibm.com> wrote:
> Fix string/tst-xbzero-opt is build with gcc head.
...
> In setup_no_clear / setup_ordinary_clear, GCC is omitting the memcpy loop in
> prepare_test_buffer. Thus count_test_patterns does not find any of the
> test_pattern.
>
> This patch introduces a compiler barrier just after filling the buffer.
I think I understand why the call to swapcontext in
prepare_test_buffer is not a sufficient compiler barrier, but I am not
a fan of asm volatile ("" ::: "memory"), because I fully expect some
future compiler to decide that there are no actual assembly
instructions being inserted so the statement can be completely
ignored. I would prefer us to find some kind of construct that
actually does make externally-visible side effects depend on the
contents of 'buf' in terms of the C abstract machine.
zw
More information about the Libc-alpha
mailing list