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/110233] [12/13/14 Regression] Wrong code at -Os on x86_64-linux-gnu
Date: Wed, 14 Jun 2023 09:03:10 +0000	[thread overview]
Message-ID: <bug-110233-4-eIma5ApmFZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110233-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> VRP2/DOM3 produces the wrong folding for some reason:
> Folding statement: _27 = b.6_9 * 2;
> Queued stmt for removal.  Folds to: 2147483647
> 
> I don't uinderstand how it could get that from:

Putting a breakpoint in execute_ranger_vrp() for the VRP2 instance, and dumping
what the ranger knows with debug_ranger() we see:

=========== BB 3 ============
b.6_9   [irange] int [1334323000, +INF] NONZERO 0x7fffffff
    <bb 3> [local count: 357878153]:
    _28 = b.6_9 * 2;
    ivtmp.19_27 = 2147483647;
    ivtmp.22_31 = (unsigned long) &f;
    goto <bb 5>; [100.00%]

ivtmp.19_27 : [irange] unsigned int [2147483647, 2147483647] NONZERO 0x7fffffff
_28 : [irange] int [+INF, +INF] NONZERO 0x7ffffffe
ivtmp.22_31 : [irange] unsigned long [1, +INF]

So on entry to BB3, b.6_9 is [1334323000, +INF].  This comes from the 2->3
edge, which is the only incoming edge to BB3.

Isn't multiplying any number in that range an overflow, and thus undefined?

Ranger is coming back with:

_28 : [irange] int [+INF, +INF] NONZERO 0x7ffffffe

which sounds reasonable, and the reason you're seeing 2147483647.

  parent reply	other threads:[~2023-06-14  9:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13  7:18 [Bug c/110233] New: " shaohua.li at inf dot ethz.ch
2023-06-14  0:36 ` [Bug middle-end/110233] [12/13/14 Regression] " pinskia at gcc dot gnu.org
2023-06-14  0:58 ` pinskia at gcc dot gnu.org
2023-06-14  9:03 ` aldyh at gcc dot gnu.org [this message]
2023-06-14  9:09 ` aldyh at gcc dot gnu.org
2023-06-15  4:51 ` pinskia at gcc dot gnu.org
2023-06-15  5:38 ` pinskia at gcc dot gnu.org
2023-06-15  5:39 ` pinskia at gcc dot gnu.org
2023-07-30 14:32 ` shaohua.li at inf dot ethz.ch
2023-07-30 14:47 ` sjames at gcc dot gnu.org
2023-07-30 14:47 ` sjames at gcc dot gnu.org
2023-07-30 15:18 ` shaohua.li at inf dot ethz.ch
2023-10-20 13:57 ` 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-110233-4-eIma5ApmFZ@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).