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 tree-optimization/104356] [12 Regression] divide by zero trap incorrectly optimized away
Date: Fri, 04 Feb 2022 07:11:11 +0000 [thread overview]
Message-ID: <bug-104356-4-fm87Wf0hr3@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104356-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104356
--- Comment #41 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to rguenther@suse.de from comment #40)
> On Thu, 3 Feb 2022, amacleod at redhat dot com wrote:
>
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104356
> >
> > --- Comment #37 from Andrew Macleod <amacleod at redhat dot com> ---
> > (In reply to Jakub Jelinek from comment #35)
> > > I meant something like:
> > > return Z / X;
> >
> > > and there evrp does with -O2 -gnatp optimize away the division.
> > > Though that is likely the X / boolean_range_Y case which you've disabled.
> > > In any case, I think you want to hear from Andrew/Aldy where exactly does
> > > VRP/ranger assume UB on integer division by zero.
> >
> > That divide is remove by the simplifier because it determines that X has a
> > range of [0,1] and I believe the simplifer chooses to ignore the 0 under
> > various circumstances.
> >
> > As for ranger, range-ops will return UNDEFINED for the range if x is known to
> > be [0,0]. This can be propagated around, and depending on how it ends up being
> > used as to what happens with it.
>
> I think that's OK as outgoing range (on the non-exceptional path - on the
> exeptional path the result isn't computed). That just may not be used
> to simplify the stmt producing the range itself of course.
That said, range-ops, from say
[0,1] = [0,2] / y;
may _not_ reason that 'y' is not 0 when non-call EH. That is, you need to be
careful on the reverse ops but I think not on the forward ops.
next prev parent reply other threads:[~2022-02-04 7:11 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-02 22:56 [Bug tree-optimization/104356] New: [12 Regression] divide by zero trap is being removed now when it should not be in some cases pinskia at gcc dot gnu.org
2022-02-02 22:57 ` [Bug tree-optimization/104356] " pinskia at gcc dot gnu.org
2022-02-02 23:08 ` jakub at gcc dot gnu.org
2022-02-03 7:32 ` rguenth at gcc dot gnu.org
2022-02-03 7:42 ` pinskia at gcc dot gnu.org
2022-02-03 7:43 ` pinskia at gcc dot gnu.org
2022-02-03 7:58 ` pinskia at gcc dot gnu.org
2022-02-03 8:34 ` rguenther at suse dot de
2022-02-03 10:40 ` ebotcazou at gcc dot gnu.org
2022-02-03 11:08 ` rguenther at suse dot de
2022-02-03 11:14 ` ebotcazou at gcc dot gnu.org
2022-02-03 11:22 ` jakub at gcc dot gnu.org
2022-02-03 11:41 ` ebotcazou at gcc dot gnu.org
2022-02-03 11:43 ` rguenth at gcc dot gnu.org
2022-02-03 11:45 ` jakub at gcc dot gnu.org
2022-02-03 11:48 ` ebotcazou at gcc dot gnu.org
2022-02-03 11:50 ` ebotcazou at gcc dot gnu.org
2022-02-03 11:52 ` rguenth at gcc dot gnu.org
2022-02-03 11:56 ` rguenth at gcc dot gnu.org
2022-02-03 12:00 ` rguenth at gcc dot gnu.org
2022-02-03 12:00 ` jakub at gcc dot gnu.org
2022-02-03 12:03 ` jakub at gcc dot gnu.org
2022-02-03 12:03 ` ebotcazou at gcc dot gnu.org
2022-02-03 12:05 ` ebotcazou at gcc dot gnu.org
2022-02-03 12:05 ` rguenther at suse dot de
2022-02-03 12:10 ` rguenth at gcc dot gnu.org
2022-02-03 12:13 ` jakub at gcc dot gnu.org
2022-02-03 12:18 ` ebotcazou at gcc dot gnu.org
2022-02-03 12:21 ` cvs-commit at gcc dot gnu.org
2022-02-03 12:28 ` ebotcazou at gcc dot gnu.org
2022-02-03 12:39 ` jakub at gcc dot gnu.org
2022-02-03 12:49 ` ebotcazou at gcc dot gnu.org
2022-02-03 12:51 ` ebotcazou at gcc dot gnu.org
2022-02-03 13:04 ` jakub at gcc dot gnu.org
2022-02-03 13:09 ` rguenther at suse dot de
2022-02-03 15:41 ` ebotcazou at gcc dot gnu.org
2022-02-03 16:28 ` [Bug tree-optimization/104356] [12 Regression] divide by zero trap incorrectly optimized away jakub at gcc dot gnu.org
2022-02-03 16:41 ` ebotcazou at gcc dot gnu.org
2022-02-03 16:51 ` amacleod at redhat dot com
2022-02-03 16:57 ` jakub at gcc dot gnu.org
2022-02-03 18:35 ` amacleod at redhat dot com
2022-02-04 7:08 ` rguenther at suse dot de
2022-02-04 7:11 ` rguenth at gcc dot gnu.org [this message]
2022-02-04 10:05 ` ebotcazou at gcc dot gnu.org
2022-02-04 11:10 ` cvs-commit at gcc dot gnu.org
2022-02-04 11:17 ` ebotcazou at gcc dot gnu.org
2022-02-04 13:46 ` amacleod at redhat dot com
2022-02-04 16:40 ` ebotcazou at gcc dot gnu.org
2022-02-04 16:45 ` 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-104356-4-fm87Wf0hr3@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).