public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/64811] New: fold_inf_compare bogus for NaNs (given -ftrapping-math)
@ 2015-01-27  2:18 jsm28 at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: jsm28 at gcc dot gnu.org @ 2015-01-27  2:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64811
           Summary: fold_inf_compare bogus for NaNs (given
                    -ftrapping-math)
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jsm28 at gcc dot gnu.org

Various optimizations in fold_inf_compare can cause "invalid" floating-point
exceptions to be present when they should be absent, or vice versa.

Folding x > +Inf to 0 should not be about HONOR_SNANS - ordered comparisons of
both quiet and signaling NaNs should raise invalid.  So if -ftrapping-math and
HONOR_NANS, this is invalid (given a strict interpretation of -ftrapping-math,
anyway).

x <= +Inf is not the same as x == x, because again that loses an exception
(equality comparisons don't raise exceptions except for signaling NaNs).

x == +Inf is not the same as x > DBL_MAX, and a similar issue applies with the
x != +Inf case - that transformation causes a spurious exception (in
particular, I've seen this in __gcc_qadd for powerpc-linux-gnu soft-float,
causing glibc testsuite failures, which is how I found this bug), not just a
missing exception.  (The existing HONOR_NANS code for NE_EXPR is only about the
result, not the exceptions raised.)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-27  2:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27  2:18 [Bug tree-optimization/64811] New: fold_inf_compare bogus for NaNs (given -ftrapping-math) jsm28 at gcc dot gnu.org

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).