This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/56020] New: FE_INVALID flag not set on comparison with NAN (unordered)
- From: "vincent-gcc at vinc17 dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 17 Jan 2013 13:13:42 +0000
- Subject: [Bug c/56020] New: FE_INVALID flag not set on comparison with NAN (unordered)
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56020
Bug #: 56020
Summary: FE_INVALID flag not set on comparison with NAN
(unordered)
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: vincent-gcc@vinc17.net
GCC doesn't set the FE_INVALID flag on comparison with NAN (<=, >=, <, >), e.g.
with:
#include <stdio.h>
#include <math.h>
#include <fenv.h>
#pragma STDC FENV_ACCESS ON
int main (void)
{
double d = NAN;
int err;
feclearexcept (FE_INVALID);
d <= 0.0;
err = ! fetestexcept(FE_INVALID);
if (err)
printf ("The FE_INVALID flag is not set\n");
return err;
}
$ gcc-snapshot --version
gcc (Debian 20130113-1) 4.8.0 20130113 (experimental) [trunk revision 195136]
[...]
$ gcc-snapshot -std=c99 -Wall nancmp.c -o nancmp -lm
nancmp.c:5:0: warning: ignoring #pragma STDC FENV_ACCESS [-Wunknown-pragmas]
#pragma STDC FENV_ACCESS ON
^
nancmp.c: In function 'main':
nancmp.c:13:3: warning: statement with no effect [-Wunused-value]
d <= 0.0;
^
$ ./nancmp
The FE_INVALID flag is not set
The "statement with no effect" warning would also be incorrect once this bug is
fixed.