On 2/2/24 10:23, Rainer Orth wrote:
c-c++-common/pr103798-2.c FAILs on Solaris when compiled as C++:
FAIL: c-c++-common/pr103798-2.c -std=gnu++14 scan-assembler-not memchr
FAIL: c-c++-common/pr103798-2.c -std=gnu++17 scan-assembler-not memchr
FAIL: c-c++-common/pr103798-2.c -std=gnu++20 scan-assembler-not memchr
FAIL: c-c++-common/pr103798-2.c -std=gnu++98 scan-assembler-not memchr
As H.J. analyzed in the PR, Solaris <string.h> declares std::memchr, not
memchr, which isn't treated as __builtin_memchr.
The problem seems to be not the std::, but that the Solaris string.h
declares
const void *memchr(const void *, int, size_t);
as specified by the C++ standard, while gcc expects the return type to
be void* like in C.
This looks like a GCC bug, not Solaris; I'd prefer to xfail the testcase
rather than work around the compiler bug.
Jason