https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79587

            Bug ID: 79587
           Summary: ICE in streamer_write_gcov_count_stream, at
                    data-streamer-out.c:343 while building Python 3.6.0
                    with PGO and LTO
           Product: gcc
           Version: 6.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: M8R-ynb11d at mailinator dot com
  Target Milestone: ---

Created attachment 40766
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40766&action=edit
preprocessed source

gcc version 6.3.0 on x86_64 linux

-----
$ gcc-6.3 -v
Using built-in specs.
COLLECT_GCC=gcc-6.3
COLLECT_LTO_WRAPPER=/home/user/tools/gcc/inst-6.3.0/libexec/gcc/x86_64-pc-linux-gnu/6.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-6.3.0/configure
--prefix=/home/user/tools/gcc/inst-6.3.0 --program-suffix=-6.3
--enable-languages=c,c++ --enable-checking=release --disable-werror
--with-build-config=bootstrap-lto
Thread model: posix
gcc version 6.3.0 (GCC) 
-----

Failing command:

-----
gcc-6.3 -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv
-O3 -Wall -Wstrict-prototypes -march=native -g0 -std=c99 -Wextra
-Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers
-fprofile-use -fprofile-correction -flto -fuse-linker-plugin -ffat-lto-objects
-flto-partition=none -DCONFIG_64=1 -DASM=1
-I/home/user/tools/python/Python-3.6.0/Modules/_decimal/libmpdec -I./Include
-I. -I/usr/include/x86_64-linux-gnu -I/usr/local/include
-I/home/user/tools/python/Python-3.6.0/Include
-I/home/user/tools/python/Python-3.6.0 -c
/home/user/tools/python/Python-3.6.0/Modules/_decimal/libmpdec/crt.c -o
build/temp.linux-x86_64-3.6/home/user/tools/python/Python-3.6.0/Modules/_decimal/libmpdec/crt.o
/home/user/tools/python/Python-3.6.0/Modules/_decimal/libmpdec/crt.c: In
function ‘crt3’:
/home/user/tools/python/Python-3.6.0/Modules/_decimal/libmpdec/crt.c:177:1:
internal compiler error: in streamer_write_gcov_count_stream, at
data-streamer-out.c:343
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
-----

The software being built is Python 3.6.0 with PGO and LTO enabled.  Steps to
reproduce:

-----
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
tar xf Python-3.6.0.tar.xz
cd Python-3.6.0
./configure --prefix=$HOME/tools/python/inst-3.6 --with-lto
--enable-optimization CC=gcc-6.3 AR=gcc-ar-6.3 RANLIB=gcc-ranlib-6.3
CFLAGS_NODIST="-march=native -g0"
make profile-opt
-----

Note that the problem only manifests when profile data is present, and the
Python build system does not stop after the above error and continues to delete
the profile data, which makes it impossible to repeat the problem just be
re-running the failing command.  This can be worked around by running the
following series of commands instead of 'make profile-opt':

-----
make clean
make profile-removal
make build_all_generate_profile
make profile-removal
make run_profile_task
make build_all_merge_profile
make clean
make build_all_use_profile
-----

The resulting .gcda file and .i preprocessed source are enough to reproduce the
problem; here is the reduced invocation with crt.gcda and crt.i (attached):

-----
gcc-6.3 -pthread -fPIC -fwrapv -O3 -std=c99 -fprofile-use -fprofile-correction
-flto -c crt.i -o crt.o
/home/user/tools/python/Python-3.6.0/Modules/_decimal/libmpdec/crt.c: In
function ‘crt3’:
/home/user/tools/python/Python-3.6.0/Modules/_decimal/libmpdec/crt.c:177:1:
internal compiler error: in streamer_write_gcov_count_stream, at
data-streamer-out.c:343
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
-----

Reply via email to