public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aldyh at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [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]
Date: Mon, 01 Aug 2022 13:58:08 +0000	[thread overview]
Message-ID: <bug-106495-4-NlNQDrJGuO@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106495-4@http.gcc.gnu.org/bugzilla/>

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 ;-).

  parent reply	other threads:[~2022-08-01 13:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01  6:29 [Bug middle-end/106495] New: " 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 [this message]
2022-08-02  6:35 ` cvs-commit at gcc dot gnu.org
2022-08-02  6:35 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-106495-4-NlNQDrJGuO@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).