- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Consider the following code:
#include <stdio.h>
double c = 0.0 / 0.0;
static double d = 0.0 / 0.0;
int main (void)
{
double e = 0.0 / 0.0;
printf ("%d %.17g\n", c != c, c);
printf ("%d %.17g\n", d != d, d);
printf ("%d %.17g\n", e != e, e);
return 0;
}
With Intel(R) oneAPI DPC++ Compiler 2021.2.0 (2021.2.0.20210317), using the "icx" command, I get the following incorrect output:
0 nan
1 nan
1 nan
i.e. with 0 instead of 1 for the identifier with external linkage (variable c). No such issue with the "clang" command (still from oneAPI 2021.2):
1 nan
1 nan
1 nan
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are also 8 MPFR tests failing apparently due to NaN returned by the library functions (this was actually how I detected the issue with NaN). But I'm not sure about the exact reason.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out to us.
We are looking into this issue internally. we will get back to you soon.
Thanks & Regards
Noorjahan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've reported this issue to our Compiler Developer.
Thanks for the test case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Default icx fp-model is fast, which enables fast-math, which enables non-standard things like no-honor-nans.
So code like c != c can be optimized away as false (0). Standard code relying on IEEE 754 floating-point needs fp-model precise at a minimum. Please use -fp-model precise.
$ gcc t12.c &&./a.out
1 nan
$ gcc t12.c -ffast-math &&./a.out
0 nan
$ icx t12.c &&./a.out
0 nan
icx t12.c -fp-model precise &&./a.out
1 nan
We are going to close this as not a defect.
Thanks,

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page