<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Floating Point gets miscompiled. in Intel® oneAPI DPC++/C++ Compiler</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Floating-Point-gets-miscompiled/m-p/1642185#M4189</link>
    <description>&lt;P class=""&gt;&lt;SPAN class=""&gt;Compiler: Intel(R) oneAPI DPC++/C++ Compiler 2025.0.0 (2025.0.0.20241008)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;OS: Windows (via Visual Studio 17.11.5)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;The following code is incorrectly compiled:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;#include &amp;lt;iostream&amp;gt;
using std::cout;
using std::endl;

#define NO_INLINE       __declspec(noinline)
#define FORCE_INLINE    inline __forceinline

class Object{
public:
    FORCE_INLINE Object(uint64_t x) : Object(nullptr, (uint32_t)x, (double)(uint32_t)(x &amp;gt;&amp;gt; 32) * 4294967296.) {}
    FORCE_INLINE Object(void*, double L, double H){
        double r0;

        r0 = (double)(L + H);
        hi = r0;

        r0 = (double)(r0 - H);
        lo = (double)(L - r0);
    }

    double lo;
    double hi;
};

NO_INLINE Object func(const Object&amp;amp; a){
    return a;
}

NO_INLINE void test_function(uint32_t k){
    uint64_t stop = (uint64_t)1 &amp;lt;&amp;lt; k;
    stop /= 4;
    for (uint64_t c = 0; c &amp;lt; stop; c++){
        Object obj = func(c);
        cout &amp;lt;&amp;lt; "c = " &amp;lt;&amp;lt; c &amp;lt;&amp;lt; ": obj = " &amp;lt;&amp;lt; obj.hi &amp;lt;&amp;lt; endl;
    }
}

int main(){
    test_function(9);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Compiler Flags:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/GS /W3 /QxAVX /Gy /Zc:wchar_t /Zi /O3 /fp:precise /D "NDEBUG" /D "_CONSOLE" /D "__INTEL_LLVM_COMPILER=20250000" /D "_UNICODE" /D "UNICODE" /Qipo /Zc:forScope /Oi /MD /Fa"x64\Release\" /EHsc /nologo /Fo"x64\Release\" /Fp"x64\Release\ICX2025 Miscompile 1.pch" &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Expected Output:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;c = 0: obj = 0
c = 1: obj = 1
c = 2: obj = 2
c = 3: obj = 3
c = 4: obj = 4
c = 5: obj = 5
c = 6: obj = 6
c = 7: obj = 7
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actual Output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;c = 0: obj = 0
c = 1: obj = 6.95222e-310
c = 2: obj = 8.04776e-312
c = 3: obj = 8.04776e-312
c = 4: obj = 6.1857e-321
c = 5: obj = 1.7407e-315
c = 6: obj = 1.26481e-321
c = 7: obj = 3.95253e-323
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 09 Nov 2024 07:23:19 GMT</pubDate>
    <dc:creator>Mysticial</dc:creator>
    <dc:date>2024-11-09T07:23:19Z</dc:date>
    <item>
      <title>Floating Point gets miscompiled.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Floating-Point-gets-miscompiled/m-p/1642185#M4189</link>
      <description>&lt;P class=""&gt;&lt;SPAN class=""&gt;Compiler: Intel(R) oneAPI DPC++/C++ Compiler 2025.0.0 (2025.0.0.20241008)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;OS: Windows (via Visual Studio 17.11.5)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;The following code is incorrectly compiled:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;#include &amp;lt;iostream&amp;gt;
using std::cout;
using std::endl;

#define NO_INLINE       __declspec(noinline)
#define FORCE_INLINE    inline __forceinline

class Object{
public:
    FORCE_INLINE Object(uint64_t x) : Object(nullptr, (uint32_t)x, (double)(uint32_t)(x &amp;gt;&amp;gt; 32) * 4294967296.) {}
    FORCE_INLINE Object(void*, double L, double H){
        double r0;

        r0 = (double)(L + H);
        hi = r0;

        r0 = (double)(r0 - H);
        lo = (double)(L - r0);
    }

    double lo;
    double hi;
};

NO_INLINE Object func(const Object&amp;amp; a){
    return a;
}

NO_INLINE void test_function(uint32_t k){
    uint64_t stop = (uint64_t)1 &amp;lt;&amp;lt; k;
    stop /= 4;
    for (uint64_t c = 0; c &amp;lt; stop; c++){
        Object obj = func(c);
        cout &amp;lt;&amp;lt; "c = " &amp;lt;&amp;lt; c &amp;lt;&amp;lt; ": obj = " &amp;lt;&amp;lt; obj.hi &amp;lt;&amp;lt; endl;
    }
}

int main(){
    test_function(9);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Compiler Flags:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/GS /W3 /QxAVX /Gy /Zc:wchar_t /Zi /O3 /fp:precise /D "NDEBUG" /D "_CONSOLE" /D "__INTEL_LLVM_COMPILER=20250000" /D "_UNICODE" /D "UNICODE" /Qipo /Zc:forScope /Oi /MD /Fa"x64\Release\" /EHsc /nologo /Fo"x64\Release\" /Fp"x64\Release\ICX2025 Miscompile 1.pch" &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Expected Output:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;c = 0: obj = 0
c = 1: obj = 1
c = 2: obj = 2
c = 3: obj = 3
c = 4: obj = 4
c = 5: obj = 5
c = 6: obj = 6
c = 7: obj = 7
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actual Output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;c = 0: obj = 0
c = 1: obj = 6.95222e-310
c = 2: obj = 8.04776e-312
c = 3: obj = 8.04776e-312
c = 4: obj = 6.1857e-321
c = 5: obj = 1.7407e-315
c = 6: obj = 1.26481e-321
c = 7: obj = 3.95253e-323
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Nov 2024 07:23:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Floating-Point-gets-miscompiled/m-p/1642185#M4189</guid>
      <dc:creator>Mysticial</dc:creator>
      <dc:date>2024-11-09T07:23:19Z</dc:date>
    </item>
    <item>
      <title>Re:Floating Point gets miscompiled.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Floating-Point-gets-miscompiled/m-p/1642823#M4193</link>
      <description>&lt;P&gt;Hi, I reproduced the issue, it seems that the compiler performed some incorrect optimization. I have escalated the issue to compiler engineering team. Thanks for reporting issues to us. &lt;/P&gt;&lt;P&gt;Meanwhile, can you try to set the optimization level to /O2 instead of /O3? In my testing, the case passes with /O2.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 12 Nov 2024 21:30:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Floating-Point-gets-miscompiled/m-p/1642823#M4193</guid>
      <dc:creator>yzh_intel</dc:creator>
      <dc:date>2024-11-12T21:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: Re:Floating Point gets miscompiled.</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Floating-Point-gets-miscompiled/m-p/1685168#M4430</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/308697"&gt;@Mysticial&lt;/a&gt;&amp;nbsp;I'd like to let you know that the issue has been fixed in compiler 2025.1, please let us know if you still see any issue.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Apr 2025 16:37:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/Floating-Point-gets-miscompiled/m-p/1685168#M4430</guid>
      <dc:creator>yzh_intel</dc:creator>
      <dc:date>2025-04-24T16:37:15Z</dc:date>
    </item>
  </channel>
</rss>

