https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71341
Bug ID: 71341 Summary: ICE at -O2 and -O3 in 32-bit and 64-bit modes on x86_64-linux-gnu (Segmentation fault, duplicate_thread_path) Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com Target Milestone: --- The following code crashes the trunk at -O2 and -O3 in 32-bit and 64-bit modes on x86_64-linux-gnu. $: gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 7.0.0 20160529 (experimental) [trunk revision 236861] (GCC) $: gcc-trunk -O2 small.c small.c: In function ‘fn1’: small.c:5:6: internal compiler error: Segmentation fault void fn1() { ^~~ 0xbbc95f crash_signal ../../gcc-source-trunk/gcc/toplev.c:333 0xdbffac duplicate_thread_path ../../gcc-source-trunk/gcc/tree-ssa-threadupdate.c:2348 0xdbffac thread_through_all_blocks(bool) ../../gcc-source-trunk/gcc/tree-ssa-threadupdate.c:2496 0xdb8bee execute ../../gcc-source-trunk/gcc/tree-ssa-threadbackward.c:686 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. $: cat small.c struct S3 { char f0; }; int a, b; void fn1() { struct S3 c = {1}; while (!c.f0 || a) { c.f0 = 0; for (; c.f0; c.f0 = b) ; } } int main() {} $: