Bug 61210 - [4.10 regression] bootstrap failure with clang
Summary: [4.10 regression] bootstrap failure with clang
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: 5.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-17 09:26 UTC by David Binderman
Modified: 2014-05-21 08:50 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-05-19 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2014-05-17 09:26:13 UTC
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
Comment 1 Manuel López-Ibáñez 2014-05-17 09:50:36 UTC
(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?
Comment 2 David Binderman 2014-05-17 11:55:30 UTC
(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.
Comment 3 Manuel López-Ibáñez 2014-05-19 09:32:40 UTC
(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.
Comment 4 Richard Biener 2014-05-19 10:41:43 UTC
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.
Comment 5 David Binderman 2014-05-19 17:58:37 UTC
(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.
Comment 6 Uroš Bizjak 2014-05-19 19:32:47 UTC
(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
Comment 7 Uroš Bizjak 2014-05-19 19:37:13 UTC
Confirmed and adding CCs.
Comment 8 Richard Sandiford 2014-05-20 14:19:16 UTC
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
Comment 9 David Binderman 2014-05-21 08:50:38 UTC
(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.