From: Marek Polacek <polacek@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
Richard Biener <rguenther@suse.de>,
Joseph Myers <joseph@codesourcery.com>
Subject: Re: [PATCH] Don't fold away division by zero (PR middle-end/66127)
Date: Wed, 13 May 2015 14:11:00 -0000 [thread overview]
Message-ID: <20150513141115.GC27320@redhat.com> (raw)
In-Reply-To: <20150513135509.GE1751@tucnak.redhat.com>
On Wed, May 13, 2015 at 03:55:10PM +0200, Jakub Jelinek wrote:
> On Wed, May 13, 2015 at 03:41:11PM +0200, Marek Polacek wrote:
> > As discussed in the PR, match.pd happily folds 0 * whatever into 0. That
> > is undesirable from the C/C++ FE POV, since it can make us accept invalid
> > initializers.
> >
> > So fixed in match.pd -- I'd hope there's a better way to do this, but this
> > seems to work. There was some fallout, but nothing unexpected or surprising.
>
> Will it handle cases 0 * (int) (1 / 0) etc., when perhaps the division by
> zero isn't immediately the operand of mult, but somewhere deeper?
It won't handle e.g. 0 * (unsigned) (1 / 0).
> Also, can't the divisor be optimized into 0 only later on, so your code
> would still see !integer_zerop there and fold into 0?
> Perhaps the answer is that in both cases we'd have simplified those already
> into a division by zero.
Yes, it's a dumb attempt.
I don't know how to reliably fix this :(. We really want
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66127#c1>...
Marek
next prev parent reply other threads:[~2015-05-13 14:11 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 13:49 Marek Polacek
2015-05-13 13:56 ` Jakub Jelinek
2015-05-13 14:11 ` Marek Polacek [this message]
2015-05-13 14:19 ` Richard Biener
2015-05-13 14:19 ` Marek Polacek
2015-05-13 15:04 ` Richard Biener
2015-05-13 15:12 ` Joseph Myers
2015-05-13 19:45 ` Marek Polacek
2015-05-13 22:49 ` Joseph Myers
2015-05-14 8:05 ` Richard Biener
2015-05-14 8:12 ` Marek Polacek
2015-05-14 9:50 ` Richard Biener
2015-05-14 10:08 ` Jakub Jelinek
2015-05-14 11:03 ` Marek Polacek
2015-05-14 11:11 ` Marek Polacek
2015-05-14 17:10 ` Steve Ellcey
2015-05-14 17:23 ` Steve Ellcey
2015-05-14 17:35 ` Marek Polacek
2015-05-14 22:26 ` Steve Ellcey
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=20150513141115.GC27320@redhat.com \
--to=polacek@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=joseph@codesourcery.com \
--cc=rguenther@suse.de \
/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).