https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63319
--- Comment #3 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- While retesting I came across this seemingly bizarre issue: markus@x4 /tmp % touch qt_pch.ii markus@x4 /tmp % g++ -w -O2 -std=c++0x -x c++-header -c qt_pch.ii qt_pch.ii:1:0: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. ==17157== Invalid read of size 1 ==17157== at 0xCBB825: ggc_get_size(void const*) (in /usr/libexec/gcc/x86_64-pc-linux-gnu/5.0.0/cc1plus) ==17157== by 0xBE7A71: gt_pch_note_object(void*, void*, void (*)(void*, void*, void (*)(void*, void*), void*)) (in /usr/libexec/gcc/x86_64-pc-linux-gnu/5.0.0/cc1plus) ==17157== by 0xBE7D4B: gt_pch_nx_cpp_macro(void*) (in /usr/libexec/gcc/x86_64-pc-linux-gnu/5.0.0/cc1plus) ==17157== by 0xC1EDFF: gt_pch_nx_lang_tree_node(void*) (in /usr/libexec/gcc/x86_64-pc-linux-gnu/5.0.0/cc1plus) ==17157== by 0xB728E0: gt_pch_nx_string_pool_data(void*) (in /usr/libexec/gcc/x86_64-pc-linux-gnu/5.0.0/cc1plus) ==17157== by 0xBE7436: gt_pch_save(_IO_FILE*) (in /usr/libexec/gcc/x86_64-pc-linux-gnu/5.0.0/cc1plus) ==17157== by 0xC10BBB: c_common_write_pch() (in /usr/libexec/gcc/x86_64-pc-linux-gnu/5.0.0/cc1plus) ==17157== by 0x5C2817: ??? (in /usr/libexec/gcc/x86_64-pc-linux-gnu/5.0.0/cc1plus) ==17157== by 0xCB561F: compile_file() [clone .lto_priv.2265] (in /usr/libexec/gcc/x86_64-pc-linux-gnu/5.0.0/cc1plus) ==17157== by 0xC2D8FD: toplev::main(int, char**) (in /usr/libexec/gcc/x86_64-pc-linux-gnu/5.0.0/cc1plus) ==17157== by 0xC2C8BC: main (in /usr/libexec/gcc/x86_64-pc-linux-gnu/5.0.0/cc1plus) ==17157== Address 0x2e is not stack'd, malloc'd or (recently) free'd ==17157== The crash only happens with a LTO/PGO bootstrapped compiler using checking=release. A --disable-bootstrap compiler with debug-info shows: markus@x4 /tmp % valgrind --track-origins=yes --trace-children=yes /var/tmp/gcc_test/usr/local/bin/g++ -w -O2 -std=c++0x -x c++-header -c qt_pch.ii ==17702== Memcheck, a memory error detector ==17702== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==17702== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info ==17702== Command: /var/tmp/gcc_test/usr/local/bin/g++ -w -O2 -std=c++0x -x c++-header -c qt_pch.ii ==17702== ==17703== Memcheck, a memory error detector ==17703== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==17703== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info ==17703== Command: /var/tmp/gcc_test/usr/local/bin/../libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/cc1plus -quiet -iprefix /var/tmp/gcc_test/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.0.0/ -D_GNU_SOURCE qt_pch.ii -quiet -dumpbase qt_pch.ii -mtune=generic -march=x86-64 -auxbase qt_pch -O2 -w -std=c++11 -o /tmp/ccjRTklN.s --output-pch=qt_pch.ii.gch ==17703== ==17703== Syscall param write(buf) points to uninitialised byte(s) ==17703== at 0x4F8A370: __write_nocancel (in /lib64/libc-2.20.90.so) ==17703== by 0x4F2B3EE: _IO_file_write@@GLIBC_2.2.5 (in /lib64/libc-2.20.90.so) ==17703== by 0x4F2A9F2: new_do_write (in /lib64/libc-2.20.90.so) ==17703== by 0x4F2C2F0: _IO_do_write@@GLIBC_2.2.5 (in /lib64/libc-2.20.90.so) ==17703== by 0x4F2BA66: _IO_file_xsputn@@GLIBC_2.2.5 (in /lib64/libc-2.20.90.so) ==17703== by 0x4F2167A: fwrite (in /lib64/libc-2.20.90.so) ==17703== by 0x88647C: ggc_pch_write_object(ggc_pch_data*, _IO_FILE*, void*, void*, unsigned long, bool) (ggc-page.c:2451) ==17703== by 0xA2C1E0: gt_pch_save(_IO_FILE*) (ggc-common.c:566) ==17703== by 0x861FEC: c_common_write_pch() (c-pch.c:197) ==17703== by 0x6E4E8C: cp_write_global_declarations() (decl2.c:4400) ==17703== by 0xC96DD3: compile_file() (toplev.c:608) ==17703== by 0x5F84EE: do_compile (toplev.c:2063) ==17703== by 0x5F84EE: toplev::main(int, char**) (toplev.c:2161) ==17703== Address 0x4049005 is not stack'd, malloc'd or (recently) free'd ==17703== Uninitialised value was created by a heap allocation ==17703== at 0x4028C70: malloc (vg_replace_malloc.c:296) ==17703== by 0x135C257: xmalloc (xmalloc.c:147) ==17703== by 0x132DC8A: _cpp_init_tokenrun (lex.c:2008) ==17703== by 0x132C28A: cpp_create_reader(c_lang, ht*, line_maps*) (init.c:238) ==17703== by 0x85F85C: c_common_init_options(unsigned int, cl_decoded_option*) (c-opts.c:234) ==17703== by 0x5F7F9D: toplev::main(int, char**) (toplev.c:2136) ==17703== by 0x5F9199: main (main.c:39)