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/67285] ICE with (rdiv (POW:s @0 REAL_CST@1) @0)
Date: Thu, 20 Aug 2015 12:26:00 -0000	[thread overview]
Message-ID: <bug-67285-4-vE3lnJbr5w@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-67285-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
There are two issues here - one is side-effects (virtual definition) and one
is dependences (virtual uses).  The first one you hit with -fmath-errno,
the second you hit with -frounding-math.

On GENERIC there can be nothing "inbetween" components of the matched
expression
so things are usually fine.

On GIMPLE there can be random statements inbetween the statements composing
the matched expression.  Like

  _1 = pow (x, 2)
  fesetround();
  _2 = _1 / x;

we may not move pow () across fesetround () with -frounding-math, thus we
may not generate the expression replacement at the point of the _2 definition.

The actual ICE is about our failure to keep the virtual operand SSA form
up-to-date in fold_stmt.  As we generally do not want to do IL walks to
find a suitable VUSE/DEF we can use for that (apart from looking at the
current statement) we generally have to fail doing the expression replacement.

Implementation-wise the easiest is to "fail" when we are trying to generate
a builtin function call which is not CONST.  That doesn't avoid all
questionable
transforms but at least should avoid the ICEs due to non-up-to-date virtual
operand form.

There are cases we could relax (like replacing a call with another call),
but let's do that separately.

Note that this will require -fno-math-errno for any late transforms regarding
to math builtins.


  parent reply	other threads:[~2015-08-20 12:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-20  4:42 [Bug middle-end/67285] New: " hs.naveen2u at gmail dot com
2015-08-20  8:54 ` [Bug middle-end/67285] " mpolacek at gcc dot gnu.org
2015-08-20  9:03 ` hs.naveen2u at gmail dot com
2015-08-20 11:47 ` rguenth at gcc dot gnu.org
2015-08-20 12:26 ` rguenth at gcc dot gnu.org [this message]
2015-08-21  8:06 ` rguenth at gcc dot gnu.org
2015-08-21  8:06 ` 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-67285-4-vE3lnJbr5w@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).