https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71987
Bug ID: 71987 Summary: ICE on valid code at -O1 and above on x86_64-linux-gnu: tree check: expected ssa_name, have addr_expr in get_ops, at tree-ssa-reassoc.c:3269 Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- The following code causes an ICE when compiled with the current GCC trunk at -O1 and above on x86_64-linux-gnu in both 32-bit and 64-bit modes. This is a regression from 6.1.x. $ 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 20160724 (experimental) [trunk revision 238696] (GCC) $ $ gcc-trunk -O0 small.c $ gcc-6.1 -O1 small.c $ $ gcc-trunk -O1 small.c small.c: In function ‘fn2’: small.c:8:6: internal compiler error: tree check: expected ssa_name, have addr_expr in get_ops, at tree-ssa-reassoc.c:3269 void fn2 () ^~~ 0xe7745c tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc-source-trunk/gcc/tree.c:9742 0xd81c18 tree_check ../../gcc-source-trunk/gcc/tree.h:3023 0xd81c18 get_ops ../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:3269 0xd882ba maybe_optimize_range_tests ../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:3523 0xd8e8f1 reassociate_bb ../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5260 0xd8e187 reassociate_bb ../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5469 0xd8e187 reassociate_bb ../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5469 0xd90d3b do_reassoc ../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5583 0xd90d3b execute_reassoc ../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5670 0xd90d3b execute ../../gcc-source-trunk/gcc/tree-ssa-reassoc.c:5709 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. $ -------------------------------- int a, b, *c, *d; short fn1 (int p1) { return a ? p1 : a; } void fn2 () { int e, *f = &e; b = fn1 (d != &e); c = f; } int main () { fn2 (); return 0; }