This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix string/tst-xbzero-opt if build with gcc head.
- From: Zack Weinberg <zackw at panix dot com>
- To: Stefan Liebler <stli at linux dot ibm dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Thu, 12 Jul 2018 12:42:32 -0400
- Subject: Re: Fix string/tst-xbzero-opt if build with gcc head.
- References: <a1bd8b21-c935-125f-0b9c-381f0ed19b5a@linux.ibm.com>
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