public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/112344] [14 Regression] Wrong code at -O2 on x86_64-pc-linux-gnu
Date: Wed, 22 Nov 2023 10:06:28 +0000	[thread overview]
Message-ID: <bug-112344-4-1JwTRJSIO1@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112344-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112344

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
In particular the final jump is miscalculated somehow, possibly path-ranger
mishandles the situation.  For the loop header we thread through we
first clear dependent ranges (good) but then do compute_ranges_in_phis
(weird, we know the incoming edge?), doing

      Value_Range r (TREE_TYPE (name));
      if (range_defined_in_block (r, name, bb))
        m_cache.set_range (name, r);

where this ends up calling ssa_range_in_phi, resulting in

[irange] int [1, 1]$69 = void


Hmm, so we have

_41 : [irange] int [1073741833, 1073741833]
_42 : [irange] int [+INF, +INF]

and

    <bb 4> [local count: 105119324]:
    _37 = e_1 + 2; 
    _38 = (unsigned int) e_1;
    _39 = 19 - _38;
    _40 = _39 / 2;
    _41 = (int) _40;
    _42 = _41 * 2;

so it's the e_9 replacement that is wrong.

This is chrec_apply, applying the unsigned number of iterations (19 - (unsigned
int) e_31) / 2 to the signed chrec {e_31 + 2, +, 2}_2.  This isn't without
overflow when computing the overall increment from INT_MIN to 19 since that
positive number cannot be represented in a signed integer type.

  parent reply	other threads:[~2023-11-22 10:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-02  6:30 [Bug middle-end/112344] New: " jwzeng at nuaa dot edu.cn
2023-11-02  6:41 ` [Bug middle-end/112344] " pinskia at gcc dot gnu.org
2023-11-02  6:42 ` pinskia at gcc dot gnu.org
2023-11-02  6:47 ` jwzeng at nuaa dot edu.cn
2023-11-02  6:49 ` pinskia at gcc dot gnu.org
2023-11-02 10:06 ` rguenth at gcc dot gnu.org
2023-11-21 19:22 ` jakub at gcc dot gnu.org
2023-11-21 19:23 ` jakub at gcc dot gnu.org
2023-11-22  7:43 ` rguenth at gcc dot gnu.org
2023-11-22  9:10 ` rguenth at gcc dot gnu.org
2023-11-22 10:06 ` rguenth at gcc dot gnu.org [this message]
2023-11-22 14:40 ` cvs-commit at gcc dot gnu.org
2023-11-22 14:41 ` rguenth at gcc dot gnu.org
2023-11-24  7:50 ` cvs-commit at gcc dot gnu.org
2024-02-18 10:07 ` cvs-commit 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-112344-4-1JwTRJSIO1@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).