LTO bootstrap throws an error on libiberty/regex.c. Removing the LTO compile options results in a successful compilation of regex.o gcc 4.9.2 Solaris 11.2 gcc configure command: ../gcc-4.9.2/configure --prefix=/Tools/SunOS_5.11_i86pc_amd64/gcc-4.9.2-allgnu --with-local-prefix=/Tools/SunOS_5.11_i86pc_amd64/gcc-4.9.2-allgnu --with-gnu-as --with-as=/usr/local/bin/gas --with-gnu-ld --with-ld=/usr/local/bin/gld --with-cpu=native --with-arch=native --enable-languages=c,c++ --with-gmp=/Tools/SunOS_5.11_i86pc_amd64/gmp-6.0.0a --with-mpfr=/Tools/SunOS_5.11_i86pc_amd64/mpfr-3.1.2 --with-mpc=/Tools/SunOS_5.11_i86pc_amd64/mpc-1.0.2 --with-isl=/Tools/SunOS_5.11_i86pc_amd64/isl-0.12.2 --with-cloog=/Tools/SunOS_5.11_i86pc_amd64/cloog-0.18.1 CC='gcc -m64' CXX='g++ -m64' LDFLAGS='-R/Tools/SunOS_5.11_i86pc_amd64/gmp-6.0.0a/lib -R/Tools/SunOS_5.11_i86pc_amd64/mpfr-3.1.2/lib -R/Tools/SunOS_5.11_i86pc_amd64/mpc-1.0.2/lib -R/Tools/SunOS_5.11_i86pc_amd64/isl-0.12.2/lib -R/Tools/SunOS_5.11_i86pc_amd64/cloog-0.18.1/lib' Bootstrap command: gmake BOOT_LDFLAGS='-R/Tools/SunOS_5.11_i86pc_amd64/gmp-6.0.0a/lib -R/Tools/SunOS_5.11_i86pc_amd64/mpfr-3.1.2/lib -R/Tools/SunOS_5.11_i86pc_amd64/mpc-1.0.2/lib -R/Tools/SunOS_5.11_i86pc_amd64/isl-0.12.2/lib -R/Tools/SunOS_5.11_i86pc_amd64/cloog-0.18.1/lib' BUILD_CONFIG=bootstrap-lto profiledbootstrap Failing command: /export/data/build/gcc-4.9.2-obj/./prev-gcc/xgcc -B/export/data/build/gcc-4.9.2-obj/./prev-gcc/ -B/Tools/SunOS_5.11_i86pc_amd64/gcc-4.9.2-allgnu/x86_64-pc-solaris2.11/bin/ -B/Tools/SunOS_5.11_i86pc_amd64/gcc-4.9.2-allgnu/x86_64-pc-solaris2.11/bin/ -B/Tools/SunOS_5.11_i86pc_amd64/gcc-4.9.2-allgnu/x86_64-pc-solaris2.11/lib/ -isystem /Tools/SunOS_5.11_i86pc_amd64/gcc-4.9.2-allgnu/x86_64-pc-solaris2.11/include -isystem /Tools/SunOS_5.11_i86pc_amd64/gcc-4.9.2-allgnu/x86_64-pc-solaris2.11/sys-include -c -DHAVE_CONFIG_H -g -O2 -flto=jobserver -frandom-seed=1 -ffat-lto-objects -fprofile-use -I. -I../../gcc-4.9.2/libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic ../../gcc-4.9.2/libiberty/regex.c -o regex.o ../../gcc-4.9.2/libiberty/regex.c: In function 'byte_re_match_2_internal': ../../gcc-4.9.2/libiberty/regex.c:8128:1: internal compiler error: in streamer_write_gcov_count_stream, at data-streamer-out.c:303 } ^ 0x136348a streamer_write_gcov_count_stream ../../gcc-4.9.2/gcc/data-streamer-out.c:303 0x136348a streamer_write_gcov_count(output_block*, long) ../../gcc-4.9.2/gcc/data-streamer-out.c:188 0xf4270d stream_out_histogram_value(output_block*, histogram_value_t*) ../../gcc-4.9.2/gcc/value-prof.c:388 0x138c4c4 output_gimple_stmt ../../gcc-4.9.2/gcc/gimple-streamer-out.c:185 0x138c4c4 output_bb(output_block*, basic_block_def*, function*) ../../gcc-4.9.2/gcc/gimple-streamer-out.c:215 0xa99095 output_function ../../gcc-4.9.2/gcc/lto-streamer-out.c:1892 0xa99095 lto_output() ../../gcc-4.9.2/gcc/lto-streamer-out.c:2084 0xaf5b07 write_lto ../../gcc-4.9.2/gcc/passes.c:2298 0xaf806f ipa_write_summaries_1 ../../gcc-4.9.2/gcc/passes.c:2360 0xaf806f ipa_write_summaries() ../../gcc-4.9.2/gcc/passes.c:2417 0x769323 ipa_passes ../../gcc-4.9.2/gcc/cgraphunit.c:2078 0x769323 compile() ../../gcc-4.9.2/gcc/cgraphunit.c:2174 0x76b3ac finalize_compilation_unit() ../../gcc-4.9.2/gcc/cgraphunit.c:2329 0x5a4bc3 c_write_global_declarations() ../../gcc-4.9.2/gcc/c/c-decl.c:10401 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.
Created attachment 34467 [details] preprocessed regex.i
Removing -fprofile-use also makes the compilation work, so it appears to be a problem with profile feedback combined with LTO. Either works individually, but error out if used together.
Hi. Can you please test it with a new release of GCC? If yes, then please attach the pre-processed file and regex.gcda file that's needed for -fprofile-use.
This looks very similar to the failure on linux-sparc64 with LTO enabled: ../../src/libiberty/strerror.c: In function 'strtoerrno': ../../src/libiberty/strerror.c:773:1: warning: '/<<PKGBUILDDIR>>/build/libiberty/strerror.gcda' profile count data file not found [-Wmissing-profile] 773 | } | ^ ../../src/libiberty/strsignal.c: In function 'strtosigno': ../../src/libiberty/strsignal.c:536:1: warning: '/<<PKGBUILDDIR>>/build/libiberty/strsignal.gcda' profile count data file not found [-Wmissing-profile] 536 | } | ^ during IPA pass: pure-const ../../src/libiberty/simple-object.c: In function 'simple_object_write_add_data': ../../src/libiberty/simple-object.c:565:1: internal compiler error: in stream_out_histogram_value, at value-prof.c:369 565 | } | ^ if [ x"" != x ]; then \ /<<PKGBUILDDIR>>/build/./prev-gcc/xgcc -B/<<PKGBUILDDIR>>/build/./prev-gcc/ -B/usr/sparc64-linux-gnu/bin/ -B/usr/sparc64-linux-gnu/bin/ -B/usr/sparc64-linux-gnu/lib/ -isystem /usr/sparc64-linux-gnu/include -isystem /usr/sparc64-linux-gnu/sys-include -isystem /<<PKGBUILDDIR>>/build/sys-include -c -DHAVE_CONFIG_H -g -O2 -fprofile-use -flto=jobserver -I. -I../../src/libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -pedantic -D_GNU_SOURCE -fPIC ../../src/libiberty/simple-object-elf.c -o noasan/simple-object-elf.o; \ else true; fi /<<PKGBUILDDIR>>/build/./prev-gcc/xgcc -B/<<PKGBUILDDIR>>/build/./prev-gcc/ -B/usr/sparc64-linux-gnu/bin/ -B/usr/sparc64-linux-gnu/bin/ -B/usr/sparc64-linux-gnu/lib/ -isystem /usr/sparc64-linux-gnu/include -isystem /usr/sparc64-linux-gnu/sys-include -isystem /<<PKGBUILDDIR>>/build/sys-include -c -DHAVE_CONFIG_H -g -O2 -fprofile-use -flto=jobserver -I. -I../../src/libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -pedantic -D_GNU_SOURCE ../../src/libiberty/simple-object-elf.c -o simple-object-elf.o ../../src/libiberty/cp-demangle.c: In function 'd_print_cast.isra.0': ../../src/libiberty/cp-demangle.c:6648:1: warning: '/<<PKGBUILDDIR>>/build/libiberty/pic/cp-demangle.gcda' profile count data file not found [-Wmissing-profile] 6648 | } | ^ ../../src/libiberty/regex.c: In function 'xregfree': ../../src/libiberty/regex.c:8131:1: warning: '/<<PKGBUILDDIR>>/build/libiberty/pic/regex.gcda' profile count data file not found [-Wmissing-profile] 8131 | } | ^ configure: creating cache ./config.cache checking build system type... sparc64-unknown-linux-gnu checking host system type... sparc64-unknown-linux-gnu checking target system type... sparc64-unknown-linux-gnu checking whether /usr/bin/make sets $(MAKE)... if [ x"" != x ]; then \ /<<PKGBUILDDIR>>/build/./prev-gcc/xgcc -B/<<PKGBUILDDIR>>/build/./prev-gcc/ -B/usr/sparc64-linux-gnu/bin/ -B/usr/sparc64-linux-gnu/bin/ -B/usr/sparc64-linux-gnu/lib/ -isystem /usr/sparc64-linux-gnu/include -isystem /usr/sparc64-linux-gnu/sys-include -isystem /<<PKGBUILDDIR>>/build/sys-include -c -DHAVE_CONFIG_H -g -O2 -fprofile-use -flto=jobserver -I. -I../../src/libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -pedantic -D_GNU_SOURCE -fPIC ../../src/libiberty/regex.c -o noasan/regex.o; \ else true; fi /<<PKGBUILDDIR>>/build/./prev-gcc/xgcc -B/<<PKGBUILDDIR>>/build/./prev-gcc/ -B/usr/sparc64-linux-gnu/bin/ -B/usr/sparc64-linux-gnu/bin/ -B/usr/sparc64-linux-gnu/lib/ -isystem /usr/sparc64-linux-gnu/include -isystem /usr/sparc64-linux-gnu/sys-include -isystem /<<PKGBUILDDIR>>/build/sys-include -c -DHAVE_CONFIG_H -g -O2 -fprofile-use -flto=jobserver -I. -I../../src/libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -pedantic -D_GNU_SOURCE ../../src/libiberty/regex.c -o regex.o if [ x"" != x ]; then \ /<<PKGBUILDDIR>>/build/./prev-gcc/xgcc -B/<<PKGBUILDDIR>>/build/./prev-gcc/ -B/usr/sparc64-linux-gnu/bin/ -B/usr/sparc64-linux-gnu/bin/ -B/usr/sparc64-linux-gnu/lib/ -isystem /usr/sparc64-linux-gnu/include -isystem /usr/sparc64-linux-gnu/sys-include -isystem /<<PKGBUILDDIR>>/build/sys-include -c -DHAVE_CONFIG_H -g -O2 -fprofile-use -flto=jobserver -I. -I../../src/libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -pedantic -D_GNU_SOURCE -fPIC ../../src/libiberty/cp-demangle.c -o noasan/cp-demangle.o; \ else true; fi yes checking for a BSD-compatible install... 0x9ab447 stream_out_histogram_value(output_block*, histogram_value_t*) ../../src/gcc/value-prof.c:369 /usr/bin/install -c Full log in: https://buildd.debian.org/status/fetch.php?pkg=gcc-9&arch=sparc64&ver=9.2.1-1&stamp=1565961822&raw=0
I can confirm that disabling LTO on sparc64 makes gcc build fine.
Can you please debug the internal compiler error? I'm interested in how 'hist' struct looks like?
(In reply to Martin Liška from comment #6) > Can you please debug the internal compiler error? > I'm interested in how 'hist' struct looks like? The gcc compile farm has a fast sparc64 porterbox running Debian unstable, so if you want, you can try it yourself.
(In reply to John Paul Adrian Glaubitz from comment #7) > (In reply to Martin Liška from comment #6) > > Can you please debug the internal compiler error? > > I'm interested in how 'hist' struct looks like? > > The gcc compile farm has a fast sparc64 porterbox running Debian unstable, > so if you want, you can try it yourself. Good, I have access to the compile farm machine. So let me take a look..
Sorry, but I can't reproduce that. I'll only need to be send the problematic *.gcda file for which you see ICE in stream_out_histogram_value. Thanks.
Hello, During GCC 10.1.0 bootstrap in LTO+PGO mode, configured as: Configured with: ../gcc-10.1.0/configure --disable-multiarch --disable-libquadmath --disable-libquadmath-support --disable-libssp --disable-libstdcxx-pch --disable-multilib --disable-nls --enable-checking=release --enable-__cxa_atexit --enable-languages=c,c++ --enable-libstdcxx-debug --enable-lto --enable-plugin --enable-threads=posix --enable-tls --with-build-config=bootstrap-lto --with-default-libstdcxx-abi=gcc4-compatible --with-linker-hash-style=gnu --with-system-zlib --with-zstd=no --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu I got following ICE: /ostash/buildtc10/gcc-10.1.0-build/./prev-gcc/xgcc -B/ostash/buildtc10/gcc-10.1.0-build/./prev-gcc/ -B/ostash/tc10/x86_64-pc-linux-gnu/bin/ -B/ostash/tc10/x86_64-pc-linux-gnu/bin/ -B/ostash/tc10/x86_64-pc-linux-gnu/lib/ -isystem /ostash/tc10/x86_64-pc-linux-gnu/include -isystem /ostash/tc10/x86_64-pc-linux-gnu/sys-include -c -DHAVE_CONFIG_H -fprofile-use -flto=jobserver -frandom-seed=1 -I. -I../../gcc-10.1.0/libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -pedantic -D_GNU_SOURCE -fcf-protection ../../gcc-10.1.0/libiberty/hashtab.c -o hashtab.o during IPA pass: fnsummary ../../gcc-10.1.0/libiberty/hashtab.c:997:1: internal compiler error: in stream_out_histogram_value, at value-prof.c:338 997 | } | ^ Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. make[3]: *** [hashtab.o] Error 1 make[3]: Leaving directory `/ostash/buildtc10/gcc-10.1.0-build/libiberty' make[2]: *** [all-stagefeedback-libiberty] Error 2 make[2]: Leaving directory `/ostash/buildtc10/gcc-10.1.0-build' make[1]: *** [stagefeedback-bubble] Error 2 make[1]: Leaving directory `/ostash/buildtc10/gcc-10.1.0-build' make: *** [profiledbootstrap] Error 2 I can provide gcda files if needed.
Created attachment 48747 [details] preprocessed abstract.c produced by -S --save-temps gcc flag
Hi, I am seeing a failure in stream_out_histogram_value building the last release of python 2.x ( 2.7.18). I just posted the preprocessed c code for this problem. Here is the failing command and following output: /tools/python/Python-2.7.18# gcc -S --save-temps -pthread -c -fno-strict-aliasing -g -O2 -g -O0 -Wall -Wstrict-prototypes -fprofile-use -fprofile-correction -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -I. -IInclude -I./Include -fPIC -DPy_BUILD_CORE -o Objects/abstract.o Objects/abstract.c during IPA pass: fnsummary Objects/abstract.c:3124:1: internal compiler error: in stream_out_histogram_value, at value-prof.c:336 3124 | } | ^ 0x70b9a4 stream_out_histogram_value(output_block*, histogram_value_t*) ../../gcc/gcc/value-prof.c:336 0x16170b0 output_gimple_stmt ../../gcc/gcc/gimple-streamer-out.c:196 0x16170b0 output_bb(output_block*, basic_block_def*, function*) ../../gcc/gcc/gimple-streamer-out.c:231 0xbfa9b4 output_function ../../gcc/gcc/lto-streamer-out.c:2198 0xbfa9b4 lto_output() ../../gcc/gcc/lto-streamer-out.c:2530 0xc91241 write_lto ../../gcc/gcc/passes.c:2612 0xc91241 ipa_write_summaries_1 ../../gcc/gcc/passes.c:2676 0xc91241 ipa_write_summaries() ../../gcc/gcc/passes.c:2731 0x9230ab ipa_passes ../../gcc/gcc/cgraphunit.c:2650 0x9230ab symbol_table::compile() ../../gcc/gcc/cgraphunit.c:2737 0x924d3c symbol_table::compile() ../../gcc/gcc/cgraphunit.c:2717 0x924d3c symbol_table::finalize_compilation_unit() ../../gcc/gcc/cgraphunit.c:2984
Hi, I see that I forgot to mention that the failure generated above was made with the "latest" gcc in the repo. revision at 280157
Confirmed.
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>: https://gcc.gnu.org/g:1921ebcaf6467996aede69e1bbe32400d8a20fe7 commit r11-3463-g1921ebcaf6467996aede69e1bbe32400d8a20fe7 Author: Martin Liska <mliska@suse.cz> Date: Fri Sep 25 16:21:34 2020 +0200 gcov: fix streaming of HIST_TYPE_IOR histogram type. gcc/ChangeLog: PR gcov-profile/64636 * value-prof.c (stream_out_histogram_value): Allow negative values for HIST_TYPE_IOR.
Fixed on master so far.
The releases/gcc-10 branch has been updated by Martin Liska <marxin@gcc.gnu.org>: https://gcc.gnu.org/g:84dc3879f377ddaecb4054a7bf7671114dfb7228 commit r10-8840-g84dc3879f377ddaecb4054a7bf7671114dfb7228 Author: Martin Liska <mliska@suse.cz> Date: Fri Sep 25 16:21:34 2020 +0200 gcov: fix streaming of HIST_TYPE_IOR histogram type. gcc/ChangeLog: PR gcov-profile/64636 * value-prof.c (stream_out_histogram_value): Allow negative values for HIST_TYPE_IOR. (cherry picked from commit 1921ebcaf6467996aede69e1bbe32400d8a20fe7)
The releases/gcc-9 branch has been updated by Martin Liska <marxin@gcc.gnu.org>: https://gcc.gnu.org/g:7c55364eaaf5f882e80e8943e702081f9648f582 commit r9-8968-g7c55364eaaf5f882e80e8943e702081f9648f582 Author: Martin Liska <mliska@suse.cz> Date: Thu Oct 1 21:28:30 2020 +0200 gcov: fix streaming of HIST_TYPE_IOR histogram type. gcc/ChangeLog: PR gcov-profile/64636 * value-prof.c (stream_out_histogram_value): Allow negative values for HIST_TYPE_IOR. (cherry picked from commit 1921ebcaf6467996aede69e1bbe32400d8a20fe7)
Resolved.
*** Bug 72848 has been marked as a duplicate of this bug. ***