Compiler ANSI check in configure breaks using Clang
Andrew Jeffery
andrew at aj.id.au
Fri Dec 11 02:09:48 CET 2009
Hi,
Purely out of interest I've been exploring using Clang[1] as my system
compiler. Running Gentoo, I figured I could give it a fairly good
thrashing by trying to emerge a complete system and report any bugs I
found. One of these is in libgmp.
Details:
* GMP Version:
4.3.1, unpatched
* Clang Version:
clang version 1.0
(https://llvm.org/svn/llvm-project/cfe/branches/release_26 exported)
Target: x86_64-pc-linux-gnu
Thread model: posix
* uname -a:
Linux amaya 2.6.32-gentoo #1 SMP Mon Dec 7 16:34:32 CST 2009 x86_64
Intel(R) Core(TM)2 Duo CPU T8300 @ 2.40GHz GenuineIntel GNU/Linux
* ./config.guess:
core2-unknown-linux-gnu
* ./configfsf.guess:
x86_64-unknown-linux-gnu
The bug revolves around `CC=/usr/bin/clang ./configure`. The check
GMP_C_FOR_BUILD_ANSI ("checking whether build system compiler is
ANSI...") fails, due to what seems to be an issue with the main function
signature. The configure script attempts to compile:
cat >conftest.c <<EOF
int
main (int argc, char *argv)
{
exit(0);
}
EOF
for the test. This code fails when compiled with clang:
$ clang conftest.c
conftest.c:2:1: error: second argument of 'main' should be of type 'char **'
main (int argc, char *argv)
^
conftest.c:4:3: warning: implicitly declaring C library function 'exit'
with type 'void (int)'
exit(0);
^
conftest.c:4:3: note: please include the header <stdlib.h> or explicitly
provide a declaration for 'exit'
3 diagnostics generated.
It seems clang is stricter on this than GCC, though I can't see why the
code contained in the configure script would be correct.
I've attached the compressed config.log as well as a patch to fix the
function declaration.
Cheers,
Andrew
[1] http://clang.llvm.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.log.tar.bz2
Type: application/x-bzip
Size: 17634 bytes
Desc: not available
URL: <http://gmplib.org/list-archives/gmp-bugs/attachments/20091211/b160c5a2/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fix-bad-ansi-check.patch
URL: <http://gmplib.org/list-archives/gmp-bugs/attachments/20091211/b160c5a2/attachment.ksh>
More information about the gmp-bugs
mailing list