public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rsandifo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/96373] SVE miscompilation on vectorized division loop, leading to FP exception
Date: Wed, 05 Aug 2020 10:28:45 +0000	[thread overview]
Message-ID: <bug-96373-4-zWn8CdnzxE@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96373-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
(In reply to rguenther@suse.de from comment #7)
> On Wed, 5 Aug 2020, rsandifo at gcc dot gnu.org wrote:
> 
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96373
> > 
> > --- Comment #6 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
> > FWIW, I think the reason I mentioned for skimping on this originally
> > was that we don't e.g. prevent if-conversion of:
> > 
> > void
> > foo (int *c, float *f)
> > {
> >   for (int i = 0; i < 16; ++i)
> >     f[i] = c[i] ? __builtin_sqrtf (f[i]) : f[i];
> > }
> > 
> > for -O2 -ftree-vectorize -fno-math-errno.  So it seemed like things
> > weren't very consistent.
> 
> I think that's a bug in if-conversion - gimple_could_trap_p only
> says that the call instruction itself doesn't trap, it doesn't
> say anything about something in the callee body.
When's that distinction useful in practice though?  It seems odd
that an FP x / y is seen as potentially trapping, but a function
call that wraps (or might wrap) an FP x / y isn't.

> You should need -fno-trapping-math to get the above if-converted.
Is there an existing ECF flag that we can check?  ECF_NOTHROW is
related but seems different enough not to be reliable.

And is trapping a “side effect“ for the purposes of:

/* Nonzero if this is a call to a function whose return value depends           
   solely on its arguments, has no side effects, and does not read              
   global memory.  This corresponds to TREE_READONLY for function               
   decls.  */
#define ECF_CONST                 (1 << 0)

I.e. can a function still be const (on the basis that a given
argument always produces the same result) while still trapping
for some arguments?  What about pure, where the trapping might
come from a memory dereference?

  parent reply	other threads:[~2020-08-05 10:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29 15:27 [Bug target/96373] New: " matz at gcc dot gnu.org
2020-08-04 13:41 ` [Bug target/96373] " rsandifo at gcc dot gnu.org
2020-08-04 13:49 ` rguenth at gcc dot gnu.org
2020-08-04 14:38 ` matz at gcc dot gnu.org
2020-08-04 14:59 ` rsandifo at gcc dot gnu.org
2020-08-04 15:46 ` schwab@linux-m68k.org
2020-08-05 10:08 ` rsandifo at gcc dot gnu.org
2020-08-05 10:15 ` rguenther at suse dot de
2020-08-05 10:28 ` rsandifo at gcc dot gnu.org [this message]
2020-08-05 11:09 ` rguenther at suse dot de
2020-08-05 12:24 ` matz at gcc dot gnu.org
2020-08-05 13:02 ` matz at gcc dot gnu.org
2023-01-11 23:50 ` pinskia at gcc dot gnu.org
2023-01-11 23:54 ` pinskia at gcc dot gnu.org
2023-01-27 17:04 ` cvs-commit at gcc dot gnu.org
2023-02-14  2:05 ` cvs-commit at gcc dot gnu.org
2023-02-14  9:18 ` cvs-commit at gcc dot gnu.org
2023-02-27  2:50 ` cvs-commit at gcc dot gnu.org
2023-02-27  2:57 ` cvs-commit at gcc dot gnu.org
2023-04-03  8:58 ` cvs-commit at gcc dot gnu.org
2023-04-14  8:19 ` [Bug target/96373] [10/11 Regression] " rguenth at gcc dot gnu.org
2023-05-29 10:03 ` jakub at gcc dot gnu.org
2024-02-29  5:33 ` [Bug target/96373] [11 " pinskia 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-96373-4-zWn8CdnzxE@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).