For months, I've been using clang and clang++ to bootstrap trunk gcc. Works faster than gcc and the warning messages are interesting ;-> In the last couple of weeks, since wide-int code went into gcc trunk, this has broke. clang suggested using flag -fheinous-gnu-extensions, but that didn't help. Here is 20140514 failing to bootstrap Comparing stages 2 and 3 warning: gcc/cc1-checksum.o differs warning: gcc/cc1plus-checksum.o differs Bootstrap comparison failure! gcc/simplify-rtx.o differs gcc/fold-const.o differs gcc/tree-ssa-ccp.o differs make[2]: *** [compare] Error 1 make[2]: Leaving directory `/home/dcb/gcc/working' make[1]: *** [stage3-bubble] Error 2 make[1]: Leaving directory `/home/dcb/gcc/working' make: *** [bootstrap] Error 2 Thu 15 May 18:28:51 BST 2014 Configure line is ../src/trunk/configure --prefix=/home/dcb/gcc/results --enable-checking=release --enable-languages=c,c++,fortran --disable-werror CC="clang -g -O2 -Wall -fheinous-gnu-extensions" CXX="clang++ -g -O2 -Wall -fheinous-gnu-extensions" and bootstrap line is make BOOT_CFLAGS='-g -O3' CFLAGS_FOR_TARGET='-g -O3' -j 2 bootstrap
(In reply to David Binderman from comment #0) > For months, I've been using clang and clang++ to bootstrap trunk gcc. > Works faster than gcc and the warning messages are interesting ;-> In which sense are they interesting?
(In reply to Manuel López-Ibáñez from comment #1) > In which sense are they interesting? They show bugs in gcc trunk. Same as running cppcheck over gcc trunk shows bugs. Both both cases, I've reported the ones that I think are worth fixing.
(In reply to David Binderman from comment #2) > (In reply to Manuel López-Ibáñez from comment #1) > > In which sense are they interesting? > > They show bugs in gcc trunk. > > Same as running cppcheck over gcc trunk shows bugs. > > Both both cases, I've reported the ones that I think are worth fixing. Thanks! As you may know, GCC doesn't currently have the resources behind Clang, so every little thing helps. I think this is being discussed in the mailing list here: https://gcc.gnu.org/ml/gcc/2014-05/msg00194.html so hopefully it will get fixed soon. It seems to be reproducible also with older GCC versions.
Can you try to use -O0 with clang as it is otherwise the default for the host compiler invocations? Thus, it may very well be a miscompilation by clang.
(In reply to Richard Biener from comment #4) > Can you try to use -O0 with clang as it is otherwise the default for the host > compiler invocations? > > Thus, it may very well be a miscompilation by clang. I think I'm right in saying that boot compiler (clang here) only does stage1. Hence a difference between stage2 and stage3 AFAIK can't be produced by clang. However, I tried out what you suggested and it made no difference. Comparing stages 2 and 3 warning: gcc/cc1-checksum.o differs warning: gcc/cc1plus-checksum.o differs Bootstrap comparison failure! gcc/simplify-rtx.o differs gcc/fold-const.o differs gcc/tree-ssa-ccp.o differs make[2]: *** [compare] Error 1 I'll try again in a few days time.
(In reply to David Binderman from comment #5) > I'll try again in a few days time. Richard S. is preparing a patch at [1], perhaps you can help to test it? [1] https://gcc.gnu.org/ml/gcc-patches/2014-05/msg01519.html
Confirmed and adding CCs.
Author: rsandifo Date: Tue May 20 14:18:44 2014 New Revision: 210645 URL: http://gcc.gnu.org/viewcvs?rev=210645&root=gcc&view=rev Log: gcc/cp/ PR bootstrap/61210 * pt.c (tsubst_copy, tsubst_omp_for_iterator, tsubst_expr) (tsubst_copy_and_build): Perform recursive substitutions in a deterministic order. Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c
(In reply to rsandifo@gcc.gnu.org from comment #8) > Author: rsandifo > Date: Tue May 20 14:18:44 2014 Seems fixed to me. Comparing stages 2 and 3 warning: gcc/cc1-checksum.o differs warning: gcc/cc1plus-checksum.o differs Comparison successful.