Fix string/tst-xbzero-opt if build with gcc head.

Stefan Liebler stli@linux.ibm.com
Mon Jul 16 11:05:00 GMT 2018


On 07/12/2018 06:42 PM, Zack Weinberg wrote:
> 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
> 

Okay. Then here is a new version of the patch without the empty asm.
If build with GCC head on s390x, setup_no_clear is now filling the 
buffer and setup_ordinary_clear is just a tail call to setup_no_clear 
(same behaviour as before).

Is this C construct okay?

Bye.
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20180713_string_tst_xbzero_opt.patch
Type: text/x-patch
Size: 1983 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20180716/743caac9/attachment.bin>


More information about the Libc-alpha mailing list