public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug middle-end/106495] New: [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] @ 2022-08-01 6:29 slyfox at gcc dot gnu.org 2022-08-01 8:38 ` [Bug middle-end/106495] " pinskia at gcc dot gnu.org ` (10 more replies) 0 siblings, 11 replies; 12+ messages in thread From: slyfox at gcc dot gnu.org @ 2022-08-01 6:29 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106495 Bug ID: 106495 Summary: [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at gcc dot gnu.org CC: rguenth at gcc dot gnu.org Target Milestone: --- Host: i686-unknown-linux-gnu Target: i686-unknown-linux-gnu This week's snapshot fails to build due to -Werror on i686-unknown-linux-gnu as: configure flags: --prefix=/<<NIX>>/gcc-13.0.0 --with-gmp-include=/<<NIX>>/gmp-with-cxx-stage3-6.2.1-dev/include --with-gmp-lib=/<<NIX>>/gmp-with-cxx-stage3-6.2.1/lib --with-mpfr-include=/<<NIX>>/mpfr-stage3-4.1.0-dev/include --with-mpfr-lib=/<<NIX>>/mpfr-stage3-4.1.0/lib --with-mpc=/<<NIX>>/libmpc-stage3-1.2.1 --with-libelf=/<<NIX>>/libelf-0.8.13 --with-native-system-header-dir=/<<NIX>>/glibc-2.35-163-dev/include --with-build-sysroot=/ --program-prefix= --enable-lto --disable-libstdcxx-pch --without-included-gettext --with-system-zlib --enable-static --enable-languages=c\,c++ --disable-multilib --enable-plugin --with-isl=/<<NIX>>/isl-stage3-0.20 --with-arch=i686 --build=i686-unknown-linux-gnu --host=i686-unknown-linux-gnu --target=i686-unknown-linux-gnu /build/build/./prev-gcc/xg++ -B/build/build/./prev-gcc/ -B/nix/store/n7mwmdj0lp1p5dih5irc2ibpzrbmdcaf-gcc-13.0.0/i686-unknown-linux-gnu/bin/ -nostdinc++ -B/build/build/prev-i686-unknown-linux-gnu/libstdc++-v3/src/.libs -B/build/build/prev-i686-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -I/build/build/prev-i686-unknown-linux-gnu/libstdc++-v3/include/i686-unknown-linux-gnu -I/build/build/prev-i686-unknown-linux-gnu/libstdc++-v3/include -I/build/gcc-13-20220731/libstdc++-v3/libsupc++ -L/build/build/prev-i686-unknown-linux-gnu/libstdc++-v3/src/.libs -L/build/build/prev-i686-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -fno-PIE -c -O2 -I/nix/store/iwn78y2lccsmribf58z84nqkb6prsxg8-glibc-2.35-163-dev/include -B/nix/store/p3w78y574wiwy8zg8mh3vg5mw4ddlqjh-glibc-2.35-163/lib/ -idirafter /nix/store/iwn78y2lccsmribf58z84nqkb6prsxg8-glibc-2.35-163-dev/include -idirafter /nix/store/n5k6i1bs84fyb8p5191mzjzb89qd0h6s-bootstrap-tools/lib/gcc/i686-unknown-linux-gnu/8.3.0/include-fixed -Wl,-rpath,/nix/store/sj99b1mb1wg0dq0aih6vnmn8flshzf5d-gcc-13.0.0-lib/lib -Wl,-L/nix/store/p3w78y574wiwy8zg8mh3vg5mw4ddlqjh-glibc-2.35-163/lib -Wl,-rpath -Wl,/nix/store/p3w78y574wiwy8zg8mh3vg5mw4ddlqjh-glibc-2.35-163/lib -Wl,-dynamic-linker=/nix/store/p3w78y574wiwy8zg8mh3vg5mw4ddlqjh-glibc-2.35-163/lib/ld-linux.so.2 -fno-checking -gtoggle -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common -DHAVE_CONFIG_H -I. -I. -I../../gcc-13-20220731/gcc -I../../gcc-13-20220731/gcc/. -I../../gcc-13-20220731/gcc/../include -I../../gcc-13-20220731/gcc/../libcpp/include -I../../gcc-13-20220731/gcc/../libcody -I/nix/store/1iwmdhhdxyxv5dyaj61qb1vbyammbb7z-gmp-with-cxx-stage3-6.2.1-dev/include -I/nix/store/py5l6yngaiw6zdz5rml85nxvxs32hs0x-mpfr-stage3-4.1.0-dev/include -I/nix/store/bqrl2cd92fb6hnxfs9m1yrx1yxn2qydk-libmpc-stage3-1.2.1/include -I../../gcc-13-20220731/gcc/../libdecnumber -I../../gcc-13-20220731/gcc/../libdecnumber/bid -I../libdecnumber -I../../gcc-13-20220731/gcc/../libbacktrace -I/nix/store/whk7v7bwhrmpgi3am9r8gmwl9k2h86m3-isl-stage3-0.20/include -o tree-ssa-threadbackward.o -MT tree-ssa-threadbackward.o -MMD -MP -MF ./.deps/tree-ssa-threadbackward.TPo ../../gcc-13-20220731/gcc/tree-ssa-threadbackward.cc In file included from ../../gcc-13-20220731/gcc/hash-table.h:248, from ../../gcc-13-20220731/gcc/coretypes.h:486, from ../../gcc-13-20220731/gcc/tree-ssa-threadbackward.cc:22: In member function 'T& vec<T, A, vl_embed>::operator[](unsigned int) [with T = basic_block_def*; A = va_heap]', inlined from 'const T& vec<T>::operator[](unsigned int) const [with T = basic_block_def*]' at ../../gcc-13-20220731/gcc/vec.h:1486:20, inlined from 'bool back_threader_profitability::profitable_path_p(const vec<basic_block_def*>&, tree, edge, bool*)' at ../../gcc-13-20220731/gcc/tree-ssa-threadbackward.cc:781:37: ../../gcc-13-20220731/gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] 890 | return m_vecdata[ix]; | ~~~~~~~~~^ ../../gcc-13-20220731/gcc/vec.h: In member function 'bool back_threader_profitability::profitable_path_p(const vec<basic_block_def*>&, tree, edge, bool*)': ../../gcc-13-20220731/gcc/vec.h:635:5: note: while referencing 'vec<basic_block_def*, va_heap, vl_embed>::m_vecdata' 635 | T m_vecdata[1]; | ^~~~~~~~~ cc1plus: all warnings being treated as errors make[3]: *** [Makefile:1146: tree-ssa-threadbackward.o] Error 1 Could be a side-effect of r13-1891 ? ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/106495] [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] 2022-08-01 6:29 [Bug middle-end/106495] New: [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] slyfox at gcc dot gnu.org @ 2022-08-01 8:38 ` pinskia at gcc dot gnu.org 2022-08-01 9:22 ` rguenth at gcc dot gnu.org ` (9 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: pinskia at gcc dot gnu.org @ 2022-08-01 8:38 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106495 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |iains at gcc dot gnu.org --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- *** Bug 106496 has been marked as a duplicate of this bug. *** ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/106495] [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] 2022-08-01 6:29 [Bug middle-end/106495] New: [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] slyfox at gcc dot gnu.org 2022-08-01 8:38 ` [Bug middle-end/106495] " pinskia at gcc dot gnu.org @ 2022-08-01 9:22 ` rguenth at gcc dot gnu.org 2022-08-01 11:51 ` rguenth at gcc dot gnu.org ` (8 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: rguenth at gcc dot gnu.org @ 2022-08-01 9:22 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106495 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-08-01 Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED Target Milestone|--- |13.0 Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- I will have a looksee. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/106495] [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] 2022-08-01 6:29 [Bug middle-end/106495] New: [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] slyfox at gcc dot gnu.org 2022-08-01 8:38 ` [Bug middle-end/106495] " pinskia at gcc dot gnu.org 2022-08-01 9:22 ` rguenth at gcc dot gnu.org @ 2022-08-01 11:51 ` rguenth at gcc dot gnu.org 2022-08-01 12:17 ` rguenth at gcc dot gnu.org ` (7 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: rguenth at gcc dot gnu.org @ 2022-08-01 11:51 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106495 --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- OK, so it's indeed an isolated path we warn on: <bb 111> [local count: 2735590]: _46 = global_options.x_param_max_fsm_thread_path_insns; if (_46 <= n_insns_157) goto <bb 113>; [34.00%] else goto <bb 116>; [66.00%] <bb 116> [local count: 1805491]: n_insns_346 = ASSERT_EXPR <n_insns_157, n_insns_157 < _46>; _233 = m_path_340->m_vec; if (_233 != 0B) goto <bb 119>; [70.00%] else goto <bb 175>; [30.00%] <bb 175> [local count: 541647]: _379 = ASSERT_EXPR <_233, _233 == 0B>; <bb 117> [local count: 541647]: _286 = MEM[(struct vec *)0B].m_vecpfx.m_num; _381 = ASSERT_EXPR <0B, 0B != 0B>; if (_286 != 4294967295) goto <bb 120>; [0.00%] else goto <bb 118>; [100.00%] <bb 118> [local count: 541647]: _391 = ASSERT_EXPR <4294967294, 4294967294 < _286>; _290 = MEM <struct vec> [(struct basic_block_def * const &)_381].m_vecdata[4294967294]; goto <bb 122>; [100.00%] ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/106495] [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] 2022-08-01 6:29 [Bug middle-end/106495] New: [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] slyfox at gcc dot gnu.org ` (2 preceding siblings ...) 2022-08-01 11:51 ` rguenth at gcc dot gnu.org @ 2022-08-01 12:17 ` rguenth at gcc dot gnu.org 2022-08-01 12:21 ` rguenth at gcc dot gnu.org ` (6 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: rguenth at gcc dot gnu.org @ 2022-08-01 12:17 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106495 --- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- if (_233 != 0B) goto <bb 113>; [70.00%] else goto <bb 111>; [30.00%] ;; succ: 113 [70.0% (guessed)] count:1263844 (estimated locally) (TRUE_VALUE,EXECUTABLE) ;; 111 [30.0% (guessed)] count:541647 (estimated locally) (FALSE_VALUE,EXECUTABLE) ;; basic block 111, loop depth 0, count 541647 (estimated locally), maybe hot ;; prev block 110, next block 112, flags: (NEW, REACHABLE, VISITED) ;; pred: 110 [30.0% (guessed)] count:541647 (estimated locally) (FALSE_VALUE,EXECUTABLE) _286 = MEM[(struct vec *)0B].m_vecpfx.m_num; so a NULL pointer check is not enough to make the NULL case cold. threadfull1 exposes the path, vrp1 warns on it (it seems VRP1 at least no longer performs any threading itself). Before threadfull1 we have ;; basic block 114, loop depth 0, count 1805491 (estimated locally), maybe hot ;; prev block 112, next block 115, flags: (NEW, REACHABLE, VISITED) ;; pred: 108 [66.0% (guessed)] count:1805489 (estimated locally) (FALSE_VALUE,EXECUTABLE) _233 = m_path_142(D)->m_vec; if (_233 != 0B) goto <bb 115>; [70.00%] else goto <bb 116>; [30.00%] ;; succ: 115 [70.0% (guessed)] count:1263844 (estimated locally) (TRUE_VALUE,EXECUTABLE) ;; 116 [30.0% (guessed)] count:541647 (estimated locally) (FALSE_VALUE,EXECUTABLE) ;; basic block 115, loop depth 0, count 1263844 (estimated locally), maybe hot ;; prev block 114, next block 116, flags: (NEW, REACHABLE, VISITED) ;; pred: 114 [70.0% (guessed)] count:1263844 (estimated locally) (TRUE_VALUE,EXECUTABLE) _234 = MEM[(const struct vec *)_233].m_vecpfx.m_num; ;; succ: 116 [always] count:1263844 (estimated locally) (FALLTHRU,EXECUTABLE) ;; basic block 116, loop depth 0, count 1805491 (estimated locally), maybe hot ;; prev block 115, next block 117, flags: (NEW, REACHABLE, VISITED) ;; pred: 114 [30.0% (guessed)] count:541647 (estimated locally) (FALSE_VALUE,EXECUTABLE) ;; 115 [always] count:1263844 (estimated locally) (FALLTHRU,EXECUTABLE) # iftmp.22_235 = PHI <0(114), _234(115)> _51 = iftmp.22_235 + 4294967294; _232 = _233->m_vecpfx.m_num; if (_51 >= _232) goto <bb 117>; [0.00%] else goto <bb 118>; [100.00%] ;; succ: 117 [never] count:0 (precise) (TRUE_VALUE,EXECUTABLE) ;; 118 [always] count:1805491 (estimated locally) (FALSE_VALUE,EXECUTABLE) ;; basic block 117, loop depth 0, count 0 (precise), probably never executed ;; prev block 116, next block 118, flags: (NEW, REACHABLE, VISITED) ;; pred: 116 [never] count:0 (precise) (TRUE_VALUE,EXECUTABLE) vec<basic_block_def*, va_heap, vl_embed>::_ZN3vecIP15basic_block_def7va_heap8vl_embedEixEj.part.0 (); ;; succ: ;; basic block 118, loop depth 0, count 1805491 (estimated locally), maybe hot ;; prev block 117, next block 119, flags: (NEW, REACHABLE, VISITED) ;; pred: 116 [always] count:1805491 (estimated locally) (FALSE_VALUE,EXECUTABLE) _52 = MEM <struct vec> [(struct basic_block_def * const &)_233].m_vecdata[_51]; I can't see from the dumps what threadfull1 does but I think it must somehow just key on # iftmp.22_235 = PHI <0(114), _234(115)> _51 = iftmp.22_235 + 4294967294; _232 = _233->m_vecpfx.m_num; if (_51 >= _232) goto <bb 117>; [0.00%] simplifying 4294967294 >= _232 on the edge from 114? But maybe the wrong-doing already starts earlier, but disabling ethread doesn't hide the diagnostic. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/106495] [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] 2022-08-01 6:29 [Bug middle-end/106495] New: [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] slyfox at gcc dot gnu.org ` (3 preceding siblings ...) 2022-08-01 12:17 ` rguenth at gcc dot gnu.org @ 2022-08-01 12:21 ` rguenth at gcc dot gnu.org 2022-08-01 12:33 ` rguenth at gcc dot gnu.org ` (5 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: rguenth at gcc dot gnu.org @ 2022-08-01 12:21 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106495 --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- Created attachment 53395 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53395&action=edit preprocessed source, trimmed at tail preprocessed source for i686-pc-linux-gnu, reproduce with ./cc1plus -fpreprocessed tree-ssa-threadbackward.ii -quiet -dumpbase tree-ssa-threadbackward.cc -dumpbase-ext .cc -mtune=generic -march=pentiumpro -g -gtoggle -O2 -Wextra -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wsuggest-attribute=format -Woverloaded-virtual=2 -Wpedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -version -fno-PIE -fno-checking -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -fno-common -o tree-ssa-threadbackward.s ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/106495] [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] 2022-08-01 6:29 [Bug middle-end/106495] New: [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] slyfox at gcc dot gnu.org ` (4 preceding siblings ...) 2022-08-01 12:21 ` rguenth at gcc dot gnu.org @ 2022-08-01 12:33 ` rguenth at gcc dot gnu.org 2022-08-01 12:58 ` rguenth at gcc dot gnu.org ` (4 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: rguenth at gcc dot gnu.org @ 2022-08-01 12:33 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106495 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #53395|0 |1 is obsolete| | --- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- Created attachment 53396 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53396&action=edit more reduced profitable_path_p More reduced, the actual function is now simply bool back_threader_profitability::profitable_path_p (const vec<basic_block> &m_path, tree , edge , bool *) { if (m_path.length () <= 1) return false; gimple *stmt = get_gimple_control_stmt (m_path[0]); estimate_num_insns (stmt, &eni_size_weights); edge entry = find_edge (m_path[m_path.length () - 1], m_path[m_path.length () - 2]); if (probably_never_executed_edge_p ((cfun + 0), entry)) return false; return true; } ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/106495] [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] 2022-08-01 6:29 [Bug middle-end/106495] New: [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] slyfox at gcc dot gnu.org ` (5 preceding siblings ...) 2022-08-01 12:33 ` rguenth at gcc dot gnu.org @ 2022-08-01 12:58 ` rguenth at gcc dot gnu.org 2022-08-01 13:04 ` rguenth at gcc dot gnu.org ` (3 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: rguenth at gcc dot gnu.org @ 2022-08-01 12:58 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106495 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aldyh at gcc dot gnu.org --- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> --- So in this case we have (gdb) p *path->m_vec->m_vecdata[0] $106 = {e = <edge 0xf4819a40 (5 -> 7)>, type = EDGE_COPY_SRC_BLOCK} (gdb) p *path->m_vec->m_vecdata[1] $107 = {e = <edge 0xf48199a0 (7 -> 9)>, type = EDGE_COPY_SRC_BLOCK} (gdb) p *path->m_vec->m_vecdata[2] $108 = {e = <edge 0xf48197e0 (9 -> 10)>, type = EDGE_NO_COPY_SRC_BLOCK} and the last edge (9 -> 10) is known to be never executed: <bb 9> [local count: 435262723]: _3 = MEM <struct vec> [(struct basic_block_def * const &)_21].m_vecdata[_2]; _4 = iftmp.22_23 + 4294967295; if (_4 >= _20) goto <bb 10>; [0.00%] we've isolated a quite "unlikely" combo here. We could go for generalizing the earlier patch, disqualifying the path if any of the edges involved. Note that profitable_path_p only gets to see 5->7->9, strangely not the final ->10? It look like only maybe_register_path () via find_taken_edge will ask profitable_path_p _again_ (but with taken_edge now set)!? So the "cheapest" way to tackle this particular case is look at taken_edge in profitable_path_p. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/106495] [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] 2022-08-01 6:29 [Bug middle-end/106495] New: [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] slyfox at gcc dot gnu.org ` (6 preceding siblings ...) 2022-08-01 12:58 ` rguenth at gcc dot gnu.org @ 2022-08-01 13:04 ` rguenth at gcc dot gnu.org 2022-08-01 13:58 ` aldyh at gcc dot gnu.org ` (2 subsequent siblings) 10 siblings, 0 replies; 12+ messages in thread From: rguenth at gcc dot gnu.org @ 2022-08-01 13:04 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106495 --- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> --- Created attachment 53397 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53397&action=edit patch I'm testing this. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/106495] [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] 2022-08-01 6:29 [Bug middle-end/106495] New: [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] slyfox at gcc dot gnu.org ` (7 preceding siblings ...) 2022-08-01 13:04 ` rguenth at gcc dot gnu.org @ 2022-08-01 13:58 ` aldyh at gcc dot gnu.org 2022-08-02 6:35 ` cvs-commit at gcc dot gnu.org 2022-08-02 6:35 ` rguenth at gcc dot gnu.org 10 siblings, 0 replies; 12+ messages in thread From: aldyh at gcc dot gnu.org @ 2022-08-01 13:58 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106495 --- Comment #9 from Aldy Hernandez <aldyh at gcc dot gnu.org> --- (In reply to Richard Biener from comment #7) > So in this case we have > > (gdb) p *path->m_vec->m_vecdata[0] > $106 = {e = <edge 0xf4819a40 (5 -> 7)>, type = EDGE_COPY_SRC_BLOCK} > (gdb) p *path->m_vec->m_vecdata[1] > $107 = {e = <edge 0xf48199a0 (7 -> 9)>, type = EDGE_COPY_SRC_BLOCK} > (gdb) p *path->m_vec->m_vecdata[2] > $108 = {e = <edge 0xf48197e0 (9 -> 10)>, type = EDGE_NO_COPY_SRC_BLOCK} > > and the last edge (9 -> 10) is known to be never executed: > > <bb 9> [local count: 435262723]: > _3 = MEM <struct vec> [(struct basic_block_def * const &)_21].m_vecdata[_2]; > _4 = iftmp.22_23 + 4294967295; > if (_4 >= _20) > goto <bb 10>; [0.00%] > > we've isolated a quite "unlikely" combo here. We could go for generalizing > the earlier patch, disqualifying the path if any of the edges involved. > > Note that profitable_path_p only gets to see 5->7->9, strangely not the > final ->10? It look like only maybe_register_path () via find_taken_edge > will ask profitable_path_p _again_ (but with taken_edge now set)!? profitable_path_p gets called during path discovery (find_paths_to_names), so we don't have complete info. The idea is that if a path so far is unprofitable, no sense looking further in that particular direction. In reality Jeff and I ran into a testcase where a partial path was not profitable, but a path with some extra blocks was. There's a PR somewhere for it, but it happened so infrequent, that this heuristic was good enough. > > So the "cheapest" way to tackle this particular case is look at taken_edge > in profitable_path_p. I would've prefered putting everything in your previous patch, since it would be shared between both threaders, though I suppose the forward threader is slowly dying ;-). ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/106495] [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] 2022-08-01 6:29 [Bug middle-end/106495] New: [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] slyfox at gcc dot gnu.org ` (8 preceding siblings ...) 2022-08-01 13:58 ` aldyh at gcc dot gnu.org @ 2022-08-02 6:35 ` cvs-commit at gcc dot gnu.org 2022-08-02 6:35 ` rguenth at gcc dot gnu.org 10 siblings, 0 replies; 12+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2022-08-02 6:35 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106495 --- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>: https://gcc.gnu.org/g:b9da686470d1c23929eefb401280ad8ba17e2a58 commit r13-1924-gb9da686470d1c23929eefb401280ad8ba17e2a58 Author: Richard Biener <rguenther@suse.de> Date: Mon Aug 1 14:59:08 2022 +0200 tree-optimization/106495 - avoid threading to possibly never executed edge The following builds upon the logic of the PR105679 fix by avoiding to thread to a known edge that is predicted as probably never executed. PR tree-optimization/106495 * tree-ssa-threadbackward.cc (back_threader_profitability::profitable_path_p): If known_edge is probably never executed avoid threading. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug middle-end/106495] [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] 2022-08-01 6:29 [Bug middle-end/106495] New: [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] slyfox at gcc dot gnu.org ` (9 preceding siblings ...) 2022-08-02 6:35 ` cvs-commit at gcc dot gnu.org @ 2022-08-02 6:35 ` rguenth at gcc dot gnu.org 10 siblings, 0 replies; 12+ messages in thread From: rguenth at gcc dot gnu.org @ 2022-08-02 6:35 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106495 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution|--- |FIXED --- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> --- Should be fixed. ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-08-02 6:35 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-08-01 6:29 [Bug middle-end/106495] New: [13 Regression] Build fails gcc/tree-ssa-threadbackward.cc:22: gcc/vec.h:890:19: error: array subscript 4294967294 is above array bounds of 'basic_block_def* [1]' [-Werror=array-bounds] slyfox at gcc dot gnu.org 2022-08-01 8:38 ` [Bug middle-end/106495] " pinskia at gcc dot gnu.org 2022-08-01 9:22 ` rguenth at gcc dot gnu.org 2022-08-01 11:51 ` rguenth at gcc dot gnu.org 2022-08-01 12:17 ` rguenth at gcc dot gnu.org 2022-08-01 12:21 ` rguenth at gcc dot gnu.org 2022-08-01 12:33 ` rguenth at gcc dot gnu.org 2022-08-01 12:58 ` rguenth at gcc dot gnu.org 2022-08-01 13:04 ` rguenth at gcc dot gnu.org 2022-08-01 13:58 ` aldyh at gcc dot gnu.org 2022-08-02 6:35 ` cvs-commit at gcc dot gnu.org 2022-08-02 6:35 ` rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).