public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/56020] New: FE_INVALID flag not set on comparison with NAN (unordered)
@ 2013-01-17 13:14 vincent-gcc at vinc17 dot net
2013-01-17 13:21 ` [Bug c/56020] " rguenth at gcc dot gnu.org
2023-01-06 17:31 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2013-01-17 13:14 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/56020] FE_INVALID flag not set on comparison with NAN (unordered)
2013-01-17 13:14 [Bug c/56020] New: FE_INVALID flag not set on comparison with NAN (unordered) vincent-gcc at vinc17 dot net
@ 2013-01-17 13:21 ` rguenth at gcc dot gnu.org
2023-01-06 17:31 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-01-17 13:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56020
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-01-17
Ever Confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-17 13:21:26 UTC ---
The comparison is dead. FENV_ACCESS is not implemented (side-effects on
FENV are not preserved). Use
if (d <= 0.0)
__asm("");
GCC uses ucomisd for the comparison, even with -fsignalling-nans.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/56020] FE_INVALID flag not set on comparison with NAN (unordered)
2013-01-17 13:14 [Bug c/56020] New: FE_INVALID flag not set on comparison with NAN (unordered) vincent-gcc at vinc17 dot net
2013-01-17 13:21 ` [Bug c/56020] " rguenth at gcc dot gnu.org
@ 2023-01-06 17:31 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-06 17:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56020
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|NEW |RESOLVED
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=34678
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 34678, FENV_ACCESS is not implemented ...
*** This bug has been marked as a duplicate of bug 34678 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-06 17:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-17 13:14 [Bug c/56020] New: FE_INVALID flag not set on comparison with NAN (unordered) vincent-gcc at vinc17 dot net
2013-01-17 13:21 ` [Bug c/56020] " rguenth at gcc dot gnu.org
2023-01-06 17:31 ` pinskia 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).