This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/82692] New: [8 Regression] Ordered comparisons used for unordered built-ins
- From: "jsm28 at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 23 Oct 2017 22:23:00 +0000
- Subject: [Bug target/82692] New: [8 Regression] Ordered comparisons used for unordered built-ins
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82692
Bug ID: 82692
Summary: [8 Regression] Ordered comparisons used for unordered
built-ins
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: jsm28 at gcc dot gnu.org
CC: ubizjak at gmail dot com
Target Milestone: ---
Target: x86_64-*-*
This was probably introduced by the fix for bug 52451.
With GCC mainline (tested with trunk r254025), some uses of unordered
__builtin_* wrongly use ordered comparison instructions on x86_64, so resulting
in spurious "invalid" exceptions for quiet NaN operands. The following test
aborts when built with -O2 for x86_64-linux-gnu, but succeeds with GCC 7. This
affects glibc's y0/y1/yn wrappers, so resulting in glibc test failures.
#include <fenv.h>
extern void abort (void);
extern void exit (int);
double __attribute__ ((noinline, noclone))
foo (double x)
{
if (__builtin_islessequal (x, 0.0) || __builtin_isgreater (x, 1.0))
return x + x;
return x * x;
}
int
main (void)
{
volatile double x = foo (__builtin_nan (""));
if (fetestexcept (FE_INVALID))
abort ();
exit (0);
}