[PATCH]: Fix failing test malloc/tst-interpose-nothread with GCC 7.
Stefan Liebler
stli@linux.vnet.ibm.com
Tue Mar 21 09:39:00 GMT 2017
Hi,
The test malloc/tst-interpose-nothread fails on s390x if built
with GCC 7 and recent glibc commit "Remove the str(n)dup inlines
from string/bits/string2.h. Although inlining"
(ae65d4f3c3995279ca458c460ebf8bab1885fa03) with output:
error: free: 0x3fffdffa010: invalid allocation index: 0 (not less than 0)
The destructor check_for_allocations in malloc/tst-interpose-aux.c is
called twice. One time after the test-child-process has finished
successfully and once after the test-parent-process finishes.
During the latter invocation, allocation_index == 0. GCC 7 is
now inlining the free function and calls unconditionally fail in
get_header as header->allocation_index (type == size_t) is always
>= allocation_index (== 0).
Before the mentioned commit above, strdup was replaced by strlen,
malloc and memcpy. The malloc call was also inlined and
allocation_index was set to one.
This patch moves the already existing compiler barrier before
the invocation of free.
Okay to commit?
ChangeLog:
* malloc/tst-interpose-aux.c (check_for_allocations):
Move compiler barrier before free.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20170321_malloc_tst_interpose.patch
Type: text/x-patch
Size: 2122 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20170321/56979441/attachment.bin>
More information about the Libc-alpha
mailing list