https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115723
--- Comment #13 from edison <edison_chan_gz at hotmail dot com> --- (In reply to GCC Commits from comment #11) > The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: > > https://gcc.gnu.org/g:286cda3461d6f5ce7d911d3f26bd4975ea7ea11d > > commit r15-1745-g286cda3461d6f5ce7d911d3f26bd4975ea7ea11d > Author: Richard Biener <rguent...@suse.de> > Date: Mon Jul 1 10:06:55 2024 +0200 > > tree-optimization/115723 - ICE with .COND_ADD reduction > > The following fixes an ICE with a .COND_ADD discovered as reduction > even though its else value isn't the reduction chain link but a > constant. This would be wrong-code with --disable-checking I think. > > PR tree-optimization/115723 > * tree-vect-loop.cc (check_reduction_path): For a .COND_ADD > verify the else value also refers to the reduction chain op. > > * gcc.dg/vect/pr115723.c: New testcase. Does this fix work with gcc 14.1? I have try to use it to replace the same file in gcc 14.1 and then build gcc 14.1, got these error: ../../gcc/tree-vect-loop.cc: In function 'bool vectorize_fold_left_reduction(loop_vec_info, stmt_vec_info, gimple_stmt_iterator*, gimple**, slp_tree, gimple*, code_helper, internal_fn, tree_n ode**, int, tree, int, vec_loop_masks*, vec_loop_lens*)': ../../gcc/tree-vect-loop.cc:7215:20: error: 'prepare_vec_mask' was not declared in this scope; did you mean 'tree_vec_map'? 7215 | mask = prepare_vec_mask (loop_vinfo, TREE_TYPE (loop_mask), | ^~~~~~~~~~~~~~~~ | tree_vec_map /d/gcc-14.1.0/gcc-14.1.0/gcc/gengtype-lex.l: In function 'int yylex(const char**)': gengtype-lex.cc:356:15: warning: this statement may fall through [-Wimplicit-fallthrough=] /d/gcc-14.1.0/gcc-14.1.0/gcc/gengtype-lex.l:119:1: note: in expansion of macro 'YY_DO_BEFORE_ACTION' /d/gcc-14.1.0/gcc-14.1.0/gcc/gengtype-lex.l:114:1: note: here gengtype-lex.cc:356:15: warning: this statement may fall through [-Wimplicit-fallthrough=] /d/gcc-14.1.0/gcc-14.1.0/gcc/gengtype-lex.l:139:1: note: in expansion of macro 'YY_DO_BEFORE_ACTION' /d/gcc-14.1.0/gcc-14.1.0/gcc/gengtype-lex.l:135:1: note: here ../../gcc/tree-vect-loop.cc: In function 'bool vectorizable_reduction(loop_vec_info, stmt_vec_info, slp_tree, slp_instance, stmt_vector_for_cost*)': ../../gcc/tree-vect-loop.cc:7701:15: error: 'lane_reducing_op_p' was not declared in this scope 7701 | if (lane_reducing_op_p (op.code)) | ^~~~~~~~~~~~~~~~~~ ../../gcc/tree-vect-loop.cc:7808:24: error: 'lane_reducing_op_p' was not declared in this scope; did you mean 'lane_reducing'? 7808 | bool lane_reducing = lane_reducing_op_p (op.code); | ^~~~~~~~~~~~~~~~~~ | lane_reducing ../../gcc/tree-vect-loop.cc: In function 'bool vect_transform_reduction(loop_vec_info, stmt_vec_info, gimple_stmt_iterator*, gimple**, slp_tree)': ../../gcc/tree-vect-loop.cc:8658:24: error: 'lane_reducing_op_p' was not declared in this scope; did you mean 'lane_reducing'? 8658 | bool lane_reducing = lane_reducing_op_p (code); | ^~~~~~~~~~~~~~~~~~ | lane_reducing ../../gcc/tree-vect-loop.cc: In function 'void update_epilogue_loop_vinfo(loop*, tree)': ../../gcc/tree-vect-loop.cc:11791:3: error: 'LOOP_VINFO_NBBS' was not declared in this scope; did you mean 'LOOP_VINFO_BBS'? 11791 | LOOP_VINFO_NBBS (epilogue_vinfo) = epilogue->num_nodes; | ^~~~~~~~~~~~~~~ | LOOP_VINFO_BBS rm -rf libcommon-target.a ar --plugin /home/edison/gcc14/libexec/gcc/x86_64-pc-linux-gnu/14.1.0/liblto_plugin.so rc libcommon-target.a i386-common.o prefix.o opts.o opts-common.o options.o vec.o hooks.o common/common-targhooks.o hash-table.o file-find.o spellcheck.o selftest.o opt-suggestions.o options-urls.o ranlib --plugin /home/edison/gcc14/libexec/gcc/x86_64-pc-linux-gnu/14.1.0/liblto_plugin.so libcommon-target.a ../../gcc/../libgcc/libgcov-util.c: In function 'void tag_counters(unsigned int, int)': ../../gcc/../libgcc/libgcov-util.c:214:59: warning: 'void* calloc(size_t, size_t)' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args] 214 | k_ctrs[tag_ix].values = values = (gcov_type *) xcalloc (sizeof (gcov_type), | ^~~~~~~~~~~~~~~~~~ ../../gcc/../libgcc/libgcov-util.c:214:59: note: earlier argument should specify number of elements, later size of each element ../../gcc/../libgcc/libgcov-util.c: In function 'void topn_to_memory_representation(gcov_ctr_info*)': ../../gcc/../libgcc/libgcov-util.c:529:43: warning: 'void* calloc(size_t, size_t)' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args] 529 | = (struct gcov_kvp *)xcalloc (sizeof (struct gcov_kvp), n); | ^~~~~~~~~~~~~~~~~~~~~~~~ ../../gcc/../libgcc/libgcov-util.c:529:43: note: earlier argument should specify number of elements, later size of each element make[3]: *** [Makefile:1198: tree-vect-loop.o] Error 1 make[3]: *** Waiting for unfinished jobs.... /bin/bash ../../gcc/../move-if-change tmp-output.cc insn-output.cc echo timestamp > s-output /bin/bash ../../gcc/../move-if-change tmp-automata.cc insn-automata.cc echo timestamp > s-automata /bin/bash ../../gcc/../move-if-change tmp-attrtab.cc insn-attrtab.cc /bin/bash ../../gcc/../move-if-change tmp-dfatab.cc insn-dfatab.cc /bin/bash ../../gcc/../move-if-change tmp-latencytab.cc insn-latencytab.cc echo timestamp > s-attrtab rm gcc.pod make[3]: Leaving directory '/home/edison/Downloads/gcc-14.1.0/build/gcc' make[2]: *** [Makefile:5063: all-stage1-gcc] Error 2 make[2]: Leaving directory '/home/edison/Downloads/gcc-14.1.0/build' make[1]: *** [Makefile:30438: stage1-bubble] Error 2 make[1]: Leaving directory '/home/edison/Downloads/gcc-14.1.0/build' make: *** [Makefile:1108: all] Error 2