public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: gcc-patches List <gcc-patches@gcc.gnu.org>,
	       Richard Biener <rguenther@suse.de>
Subject: Re: [PATCH] Fold x/x to 1, 0/x to 0 and 0%x to 0 consistently
Date: Wed, 08 Jun 2016 17:52:00 -0000	[thread overview]
Message-ID: <20160608175235.GL7387@tucnak.redhat.com> (raw)
In-Reply-To: <CADzB+2nfhu30aLwxvZC-p364wqEUnVBUwK2PyxAFc5=TgnR2OA@mail.gmail.com>

On Wed, Jun 08, 2016 at 01:43:56PM -0400, Jason Merrill wrote:
> > A few random ideas I was considering:
> > * restrict it to GIMPLE, so we can't have a regression in the front-ends.
> > * fold x/0 to 0 with TREE_OVERFLOW set, to tell the front-end that something
> > is going on.
> > * fold to (x/y,0) or (x/y,1) so the division by 0 is still there, but C++11
> > constexpr might give a strange message about it, and folding might not be
> > idempotent.
> 
> Any of these would avoid the constexpr regression, though the second
> would make the diagnostic worse.  Or the front end could copy
> constexpr function bodies before folding.

Or, both cxx_eval_binary_expression and cp_fold would need to
not fold if the divisor is integer_zerop.

	Jakub

  reply	other threads:[~2016-06-08 17:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 10:42 Richard Biener
2016-06-08 15:16 ` Marc Glisse
2016-06-08 17:44   ` Jason Merrill
2016-06-08 17:52     ` Jakub Jelinek [this message]
2016-06-08 22:18       ` Marc Glisse
2016-06-09  6:53         ` Richard Biener
2016-06-09  6:50     ` Richard Biener
2016-06-09  7:16       ` Jakub Jelinek
2016-06-09  7:39         ` Richard Biener
2016-06-09 22:07           ` Jason Merrill
2016-06-10  7:11             ` Richard Biener
2016-06-10 16:16               ` Jason Merrill
2016-06-10 18:56                 ` Richard Biener

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=20160608175235.GL7387@tucnak.redhat.com \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.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).