While doing testing, I found that I couldn't bootstrap GCC anymore during holidays. Using git bisect, I found first breaking commit: d326c10c2de4a884476d099dbeca4794e145d8c1 / r219076. Last good commit: 09196675b74bd04b562fe3b264a9648eb0568a59 / r219075 Last tested bad: 27f6a8a0012f8df67c88b9d28ab47c3492319a07 / r219158 Tested on Fedora 21 OpenStack image (clean setup). Commands executed on a new virtual machine: yum makecache yum update yum -y groupinstall "Development Tools" yum -y groupinstall "C Development Tools and Libraries" yum -y install zlib-devel mkdir -p /build cd /build/ git clone git://gcc.gnu.org/git/gcc.git git checkout d326c10c2de4a884476d099dbeca4794e145d8c1 ./contrib/download_prerequisites mkdir obj cd obj ../configure --prefix=/tmp/gccbuild --enable-bootstrap --disable-checking --enable-languages=c,c++ --disable-multilib --with-system-zlib --enable-shared --disable-nls make -j4 bootstrap [snip] make[2]: Entering directory '/build/gcc/obj' make[3]: Entering directory '/build/gcc/obj' rm -f stage_current make[3]: Leaving directory '/build/gcc/obj' Comparing stages 2 and 3 warning: gcc/cc1-checksum.o differs warning: gcc/cc1plus-checksum.o differs Bootstrap comparison failure! gcc/valtrack.o differs gcc/rtlanal.o differs gcc/tree-ssa-ccp.o differs gcc/tree-nested.o differs gcc/tree-vect-stmts.o differs gcc/tree-ssa-loop-ivopts.o differs gcc/tree-sra.o differs gcc/dwarf2out.o differs gcc/lto/lto.o differs gcc/c/c-typeck.o differs gcc/c/c-array-notation.o differs gcc/c/c-decl.o differs gcc/c/c-parser.o differs gcc/tree-ssa-uninit.o differs gcc/i386.o differs gcc/tree-ssa.o differs gcc/expr.o differs gcc/except.o differs gcc/tree-ssa-reassoc.o differs gcc/rtl-error.o differs gcc/tree-ssa-tail-merge.o differs gcc/omp-low.o differs gcc/ipa-icf.o differs gcc/dominance.o differs gcc/toplev.o differs gcc/tree-ssa-structalias.o differs gcc/ipa-pure-const.o differs gcc/ipa-profile.o differs gcc/coverage.o differs gcc/ifcvt.o differs gcc/tree-ssa-threadedge.o differs gcc/tree-inline.o differs gcc/trans-mem.o differs gcc/lto-streamer-out.o differs gcc/loop-iv.o differs gcc/ipa-polymorphic-call.o differs gcc/ipa-reference.o differs gcc/tree-ssa-math-opts.o differs gcc/graphite-sese-to-poly.o differs gcc/cgraph.o differs gcc/sese.o differs gcc/ipa-split.o differs gcc/tree-ssa-sccvn.o differs gcc/tree-into-ssa.o differs gcc/alias.o differs gcc/attribs.o differs gcc/c-family/c-pretty-print.o differs gcc/c-family/array-notation-common.o differs gcc/c-family/c-common.o differs gcc/ipa-inline-analysis.o differs gcc/vtable-verify.o differs gcc/ipa-chkp.o differs gcc/cfgrtl.o differs gcc/ipa-inline-transform.o differs gcc/tree-ssa-loop-im.o differs gcc/dwarf2cfi.o differs gcc/tree-ssa-dom.o differs gcc/tree-eh.o differs gcc/gcov.o differs gcc/loop-invariant.o differs gcc/tree-vrp.o differs gcc/opts.o differs gcc/combine-stack-adj.o differs gcc/gimplify.o differs gcc/varasm.o differs gcc/tree-ssa-pre.o differs gcc/ipa-cp.o differs gcc/tree-cfg.o differs gcc/ipa-prop.o differs gcc/cfgloop.o differs gcc/tree-chkp.o differs gcc/ipa-comdats.o differs gcc/tree-vectorizer.o differs gcc/postreload.o differs gcc/lto-streamer-in.o differs gcc/build/genmatch.o differs gcc/ipa-icf-gimple.o differs gcc/cfg.o differs gcc/optabs.o differs gcc/tsan.o differs gcc/var-tracking.o differs gcc/loop-unroll.o differs gcc/cp/pt.o differs gcc/cp/parser.o differs gcc/cp/typeck2.o differs gcc/cp/decl.o differs gcc/cp/rtti.o differs gcc/cp/call.o differs gcc/cp/init.o differs gcc/cp/cp-array-notation.o differs gcc/cp/name-lookup.o differs gcc/cp/constexpr.o differs gcc/cp/semantics.o differs gcc/tree-ssa-loop-niter.o differs isl/isl_arg.o differs isl/isl_ilp.o differs isl/isl_tab_pip.o differs isl/isl_space.o differs isl/isl_transitive_closure.o differs isl/isl_stream.o differs isl/isl_output.o differs libiberty/d-demangle.o differs libiberty/pic/d-demangle.o differs mpfr/lngamma.o differs mpfr/gamma.o differs Makefile:22563: recipe for target 'compare' failed make[2]: *** [compare] Error 1 make[2]: Leaving directory '/build/gcc/obj' Makefile:22542: recipe for target 'stage3-bubble' failed make[1]: *** [stage3-bubble] Error 2 make[1]: Leaving directory '/build/gcc/obj' Makefile:22605: recipe for target 'bootstrap' failed make: *** [bootstrap] Error 2
Bootstrap worked for me yesterday. I guess disable-checking may be the reason, I will try to reproduce this.
Reproduced on recent revision (219345). Indeed, --disable-checking causes comparison to fail. Bootstrap fails: configure --prefix=/usr/local/gcc-5.0.0 --enable-clocale=gnu --with-system-zlib --enable-shared --enable-bootstrap --disable-checking --disable-multilib --disable-nls --with-demangler-in-ld --with-fpmath=sse --enable-languages=c,c++ Bootstrap passes: configure --prefix=/usr/local/gcc-5.0.0 --enable-clocale=gnu --with-system-zlib --enable-shared --enable-bootstrap --disable-multilib --disable-nls --with-demangler-in-ld --with-fpmath=sse --enable-languages=c,c++
This is caused by the @@ -1695,10 +1680,9 @@ if (!edge->inline_failed || !edge->callee->analyzed) continue; - /* Be sure that caches are maintained consistent. - We can not make this ENABLE_CHECKING only because it cause different - updates of the fibheap queue. */ - cached_badness = edge_badness (edge, false); +#ifdef ENABLE_CHECKING + /* Be sure that caches are maintained consistent. */ + sreal cached_badness = edge_badness (edge, false); reset_edge_growth_cache (edge); reset_node_growth_cache (edge->callee); @@ -1708,10 +1692,18 @@ current_badness = edge_badness (edge, false); gcc_assert (cached_badness == current_badness); gcc_assert (current_badness >= badness); +#else + current_badness = edge_badness (edge, false); +#endif changes in particular, clearly the old comment was correct. With --disable-checking --enable-stage1-checking defaults to yes,types and because of this #ifdef stage1 behaves differently from stage2. But it is certainly bad even if --disable-checking compiler behaves differently from --enable-checking=yes one. If I replace #ifdef ENABLE_CHECKING with #if 1 // ENABLE_CHECKING, --disable-checking bootstrap succeeds just fine.
The comment is no longer valid, because no updates are made inside of the ifdef block. What probably happens is that the edge growth cache is not up to date but the problem is not noticed by the sanity check. I fixed some of cache updates recently, does it solve the problem?
I've reproduced the bootstrap failure with r219533. Did you mean r219536?
On second thought it is easy to add function that verifies cache consistency instead of resetting it that should catch any potential issues. I will look into it today. It seems that there are some extra latent bugs surfaced by the more sensitive sreal costs.
OK, there are at least two issues. First is that we mix up alias with its target (i.e. clear caches on alias instead of alias target) and second that we still use node growth cache in some cases. Major use in the badness calculation was removed by Richard few releases back and its updating code was removed. The cache however remained and it is used at the end of inlining to inline functions called once etc. I am testing full removal, but need to benchmark it on firefox just to be sure.
Created attachment 34441 [details] Proposed fix I am testing the attached patch. Seems that it has no negaitve impact on firefox linktime.
Author: hubicka Date: Wed Jan 14 03:47:17 2015 New Revision: 219572 URL: https://gcc.gnu.org/viewcvs?rev=219572&root=gcc&view=rev Log: PR ipa/64481 * ipa-inline-analysis.c (node_growth_cache): Remove. (initialize_growth_caches): Do not initialize it. (free_growth_caches): Do not free it. (do_estimate_growth): Rename to ... (estimate_growth): ... this one; drop growth cache code. (growth_likely_positive): Always go the heuristics way. * ipa-inline.c (can_inline_edge_p): Walk through aliases. (reset_edge_caches): Do not reset node growth. (heap_edge_removal_hook): Do not maintain cache. (inline_small_functions): Likewise; strenghten sanity check. (ipa_inline): Do not maintain caches. * ipa-inline.h (node_growth_cache): Remove. (do_estimate_growth): Remove to ... (estimate_growth): this one; remove inline version. (reset_node_growth_cache): Remove. Modified: trunk/gcc/ChangeLog trunk/gcc/ipa-inline-analysis.c trunk/gcc/ipa-inline.c trunk/gcc/ipa-inline.h
Fixed.