Intel® oneAPI Base Toolkit
Support for the core tools and libraries within the base toolkit that are used to build and deploy high-performance data-centric applications.
Announcements
358 Discussions

## ICX bug (bad code) with __float128 [2021.1 Beta 20200715] Beginner
996 Views

When testing GNU MPFR with ICX 2021.1 Beta 20200715, the test tset_float128 failed. Here's a simple testcase:

``````#include <stdio.h>

void foo (__float128 d)
{
int i;
__float128 p, q;

if (d >= 1.0)
{
p = 2.0;
q = 0.5;
printf ("q = %a\n", (double) q);
for (i = 0; i < 13 && d >= p[i]; i++)
{
printf ("q[%d] = %a\n", i, (double) q[i]);
p[i+1] = p[i] * p[i];
q[i+1] = q[i] * q[i];
}
for (; i >= 0; i--)
if (d >= p[i])
d *= q[i];
}
else if (d < 0.5)
{
p = 2.0;
q = 0.5;
for (i = 0; i < 13 && d < q[i]; i++)
{
p[i+1] = p[i] * p[i];
q[i+1] = q[i] * q[i];
}
for (; i >= 0; i--)
while (d < q[i])
d *= p[i];
}

return;
}

int main (void)
{
volatile __float128 d = 65536;

foo (d);
return 0;
}``````

When I compile this code with optimizations (i.e. not with -O0), I get:

``````q = 0x1p-1
q = 0x0p+0
q = 0x0p+0
q = 0x0p+0
q = 0x0p+0
q = 0x0p+0``````

``````q = 0x1p-1
q = 0x1p-1
q = 0x1p-2
q = 0x1p-4
q = 0x1p-8
q = 0x1p-16``````

4 Replies Beginner
991 Views

Actually the bug occurs only with -O and -O2 (not with -O1 and -O3). So I assume that -O is equivalent to -O2. Moderator
971 Views

Hi,

Thank you for reporting this issue. We are also getting the same incorrect result with -O2 flag whereas we are getting the correct results with O1 and O3 flag as mentioned by you. As it seems a bug to us, we are forwarding this bug to the concerned team. They will get back to you.

Warm Regards,

Abhishek Moderator
695 Views

Hi Vincent,

Thanks for your patience. The issue raised by you has been fixed in the latest OneAPI version 2021.2. Please download and let us know your experience with it. Moderator
677 Views

Hi Vincent,

We are closing this thread as the issue has been fixed. 