https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77544
Bug ID: 77544 Summary: [Regression 6/7] segfault at -O0 - infinite loop in simplification Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: babokin at gmail dot com Target Milestone: --- Created attachment 39594 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39594&action=edit reproducer > g++ -O0 -c func.cpp g++: internal compiler error: Segmentation fault (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Here's top of the stack when it fails (stack is huge): #0 0x0000000000a37c59 in operand_equal_p (...) at ./svn/trunk/gcc/fold-const.c:2744 #1 0x0000000000a37e50 in operand_equal_p (...) at ./svn/trunk/gcc/fold-const.c:2750 #2 0x000000000115c676 in generic_simplify_MINUS_EXPR (...) at generic-match.c:11785 #3 0x0000000001174bbe in generic_simplify (...) at generic-match.c:31249 #4 0x0000000000a47af3 in fold_binary_loc (...) at ./svn/trunk/gcc/fold-const.c:9161 #5 0x0000000000a52a0b in fold_build2_stat_loc (...) at ./svn/trunk/gcc/fold-const.c:12291 #6 0x0000000001138dc0 in generic_simplify_181 (...) at generic-match.c:6690 #7 0x000000000114c81b in generic_simplify_PLUS_EXPR (...) at generic-match.c:11152 #8 0x0000000001174bde in generic_simplify (...) at generic-match.c:31245 #9 0x0000000000a47af3 in fold_binary_loc (...) at ./svn/trunk/gcc/fold-const.c:9161 #10 0x0000000000a52a0b in fold_build2_stat_loc (...) at ./svn/trunk/gcc/fold-const.c:12291 #11 0x0000000000a4a142 in fold_binary_loc (...) at ./svn/trunk/gcc/fold-const.c:9695 #12 0x0000000000a52a0b in fold_build2_stat_loc (...) at ./svn/trunk/gcc/fold-const.c:12291 #13 0x000000000115c762 in generic_simplify_MINUS_EXPR (...) at generic-match.c:12390 It's reproducible with gcc6 and trunk. gcc5 works. GCC build details: > g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/users/ddd/gcc_20160909/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /users/ddd/stability/svn/trunk/configure --with-arch=corei7 --with-cpu=corei7 --enable-clocale=gnu --enable-libmpx=yes --with-system-zlib --enable-shared --with-demangler-in-ld --enable-cloog-backend=isl --with-fpmath=sse --with-pkgversion=Revision=240038/svn-rev:240038/ --prefix=/users/ddd/stability/work/trunk/64/install --enable-languages=c,c++,fortran,java,lto Thread model: posix gcc version 7.0.0 20160908 (experimental) (Revision=240038/svn-rev:240038/)