2017-09-22 17:55:58 UTC
CC'ing to bug-coreutils.]
Thanks for the heads-up. That's odd, as I just looked at the LLVM source
code, and cfe-5.0.0.src/lib/Frontend/InitPreprocessor.cpp defines
__GNUC__ to 4, whereas Coreutils (via Gnulib) doesn't use
__builtin_mul_overflow_p unless __GNUC__ is at least 7.
To help debug this, what is the value of __GNUC__ on your platform? For
example, what is the output of the following shell command?
echo __GNUC__ | /usr/bin/clang -E -
and what happens if you append this line to lib/mbsstr.c
and then run this (long, one-line) command:
/usr/bin/clang -E -I. -I./lib -Ilib -I./lib -Isrc -I./src -Os -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fPIC -flto -fPIC -D_GNU_SOURCE=1 lib/mbsstr.c >lib/mbsstr.i
and look at the last few lines of lib/mbsttr.i?
On Fedora 26, which has clang version 4.0.1 (tags/RELEASE_401/final), these commands say that __GNUC__ is 4, which is what I would expect.
Also, does the attached patch to lib/intprops.h work around the problem?