https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70916
Bug ID: 70916 Summary: gcc ICE at -O3 on valid code on x86_64-linux-gnu in "tree_operand_check" Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: helloqirun at gmail dot com Target Milestone: --- The following valid code causes an ICE when compiled with the current gcc trunk at only -O3 on x86_64-linux-gnu in both 32-bit and 64-bit modes. It appears to be a 6 regression. Gcc-6.1 got an ICE at -O3 with seg fault. $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 7.0.0 20160502 (experimental) [trunk revision 235753] (GCC) $ gcc-trunk -O3 abc.c -c abc.c: In function ‘fn1’: abc.c:9:13: warning: initialization makes integer from pointer without a cast [-Wint-conversion] int m = l; ^ abc.c:14:24: warning: comparison of distinct pointer types lacks a cast *e = (((*o = &g) != g) < h[c], 0) || k; ^~ abc.c:17:12: warning: assignment makes integer from pointer without a cast [-Wint-conversion] *e = h; ^ abc.c:6:6: internal compiler error: tree check: expected class ‘expression’, have ‘constant’ (integer_cst) in tree_operand_check, at tree.h:3523 void fn1() { ^~~ 0xe435a7 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc/gcc/tree.c:9793 0x12f1f9d expr_check(tree_node*, char const*, int, char const*) ../../gcc/gcc/tree.h:3194 0x12f1f9d tree_operand_check(tree_node*, int, char const*, int, char const*) ../../gcc/gcc/tree.h:3523 0x12f1f9d vect_recog_mask_conversion_pattern ../../gcc/gcc/tree-vect-patterns.c:3677 0x12ec3c0 vect_pattern_recog_1 ../../gcc/gcc/tree-vect-patterns.c:3851 0x12f13bd vect_pattern_recog(vec_info*) ../../gcc/gcc/tree-vect-patterns.c:4048 0xe07c77 vect_analyze_loop_2 ../../gcc/gcc/tree-vect-loop.c:1847 0xe07c77 vect_analyze_loop(loop*) ../../gcc/gcc/tree-vect-loop.c:2264 0xe1e982 vectorize_loops() ../../gcc/gcc/tree-vectorizer.c:532 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 abc.c int a, b, c, d, i, k; int static *e = &b, *j; int **f; int static ***g = &f; int *h; void fn1() { for (;;) { int l[1] = {}; int m = l; for (; d; d--) { int ****n; int *****o = &n; i = a & 7 ?: a; *e = (((*o = &g) != g) < h[c], 0) || k; if (*e) { **n = &j; *e = h; } } } }