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
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.
Hi,
Thanks for reaching out to us.
We are looking into this issue internally. we will get back to you soon.
Thanks & Regards
Noorjahan
I've reported this issue to our Compiler Developer.
Thanks for the test case.
For more complete information about compiler optimizations, see our Optimization Notice.