https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85759
--- Comment #19 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Stefan Talpalaru from comment #18) > Another clue emerged: the ICE appears only when the same source file is > compiled multiple times. > > When building the extensions, Python replaces the boring Makefile with its > own "distutils" build tool that fails to do conditional compilation based on > the source and target modification times. > > Since "timemodule.c" is used by 3 different extensions, it's being compiled > 3 times in the profile generation phase and this somehow corrupts the > corresponding .gcda file. Once this silly build tool is fixed so it compiles > it a single time, the ICE disappears. Yes, I've noticed that as well. Just wanted to inform you. I've cooked a patch for that prints following: ... gcc -pthread -fPIC -fno-strict-aliasing -O3 -march=native -pipe -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fprofile-generate -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -I. -IInclude -I./Include -I/usr/local/include -I/home/marxin/Programming/testcases/python-lto-ice-v2/playground/cpython-2.7.15/Include -I/home/marxin/Programming/testcases/python-lto-ice-v2/playground/cpython-2.7.15 -c /home/marxin/Programming/testcases/python-lto-ice-v2/playground/cpython-2.7.15/Modules/itertoolsmodule.c -o build/temp.linux-x86_64-2.7/home/marxin/Programming/testcases/python-lto-ice-v2/playground/cpython-2.7.15/Modules/itertoolsmodule.o profiling:/home/marxin/Programming/testcases/python-lto-ice-v2/playground/cpython-2.7.15/build/temp.linux-x86_64-2.7/home/marxin/Programming/testcases/python-lto-ice-v2/playground/cpython-2.7.15/Modules/timemodule.gcda:overwriting an existing profile data with a different timestamp profiling:exiting after an error profiling:/home/marxin/Programming/testcases/python-lto-ice-v2/playground/cpython-2.7.15/build/temp.linux-x86_64-2.7/home/marxin/Programming/testcases/python-lto-ice-v2/playground/cpython-2.7.15/Modules/timemodule.gcda:overwriting an existing profile data with a different timestamp profiling:exiting after an error ... Note I also introduced GCOV_EXIT_AT_ERROR env. variable that should be handy for package builds.