build of gdb-7.11.1 with gcc Revision: 240867 fails with ICE last week it was OK. ../../gdb-7.11.1/gdb/coffread.c: In function 'decode_type': ../../gdb-7.11.1/gdb/coffread.c:1816:1: internal compiler error: tree check: expected ssa_name, have bit_and_expr in optimize_range_tests_var_bound, at tree-ssa-reassoc.c:2881 decode_type (struct coff_symbol *cs, unsigned int c_type, ^~~~~~~~~~~ 0xe1d73c tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc-trunk/gcc/tree.c:9743 0xd371b1 tree_check(tree_node*, char const*, int, char const*, tree_code) ../../gcc-trunk/gcc/tree.h:3031 0xd371b1 optimize_range_tests_var_bound ../../gcc-trunk/gcc/tree-ssa-reassoc.c:2881 0xd371b1 optimize_range_tests ../../gcc-trunk/gcc/tree-ssa-reassoc.c:3113 0xd38c7f reassociate_bb ../../gcc-trunk/gcc/tree-ssa-reassoc.c:5604 0xd38aad reassociate_bb ../../gcc-trunk/gcc/tree-ssa-reassoc.c:5723 0xd38aad reassociate_bb ../../gcc-trunk/gcc/tree-ssa-reassoc.c:5723 0xd3b3b9 do_reassoc ../../gcc-trunk/gcc/tree-ssa-reassoc.c:5837 0xd3b3b9 execute_reassoc ../../gcc-trunk/gcc/tree-ssa-reassoc.c:5924 0xd3b3b9 execute ../../gcc-trunk/gcc/tree-ssa-reassoc.c:5963 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. make[2]: *** [coffread.o] Error 1 make[2]: Leaving directory `/home/ed/gnu/gdb-build/gdb' make[1]: *** [all-gdb] Error 2 make[1]: Leaving directory `/home/ed/gnu/gdb-build' make: *** [all] Error 2
this seems to fix it: Index: gcc/tree-ssa-reassoc.c =================================================================== --- gcc/tree-ssa-reassoc.c (revision 240867) +++ gcc/tree-ssa-reassoc.c (working copy) @@ -2876,7 +2876,7 @@ gimple *stmt; tree_code ccode; tree rhs1, rhs2; - if (ranges[i].exp) + if (ranges[i].exp && TREE_CODE (ranges[i].exp) == SSA_NAME) { stmt = SSA_NAME_DEF_STMT (ranges[i].exp); if (!is_gimple_assign (stmt))
reproducer: cat min.c union internal_auxent { struct { union { long l; } x_tagndx; } x_sym; }; struct coff_symbol { int c_sclass; }; int complaint (); int decode_type (struct coff_symbol * cs, union internal_auxent * aux) { if (aux->x_sym.x_tagndx.l) if (cs->c_sclass != 10 && cs->c_sclass != 12 && aux->x_sym.x_tagndx.l >= 0) complaint (); }
Created attachment 39775 [details] gcc7-pr77901.patch Thanks for the report, but the #c1 patch is incorrect, we don't want to handle .exp non-NULL other than SSA_NAME as if it is a GIMPLE_COND comparison at the end of bb, we just want to ignore that instead.
ok, thanks.
Author: jakub Date: Sun Oct 9 11:18:53 2016 New Revision: 240899 URL: https://gcc.gnu.org/viewcvs?rev=240899&root=gcc&view=rev Log: PR tree-optimization/77901 * tree-ssa-reassoc.c (optimize_range_tests_var_bound): Only optimize if ranges[i].exp is SSA_NAME when looking for >= and only when ranges[i].exp is NULL or SSA_NAME when looking for the other comparison. * gcc.c-torture/compile/pr77901.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/compile/pr77901.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-reassoc.c
Fixed.