<?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 Re: unintentional dead code elimination in Intel® oneAPI DPC++/C++ Compiler</title>
    <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1671178#M4323</link>
    <description>Ok. I probably didn't write a clear message. My concern is that WITHOUT uncommenting those lines (i.e. leaving the code as it is), on my two Windows machines the Intel compiler does not give any error. But the errors are clearly there. Those errors are in parts of the code that are not used (that's why I wrote dead code elimination). IF I use the -std=c++20, then the errors are finally found. On a Linux cluster, the errors are correctly seen with both c++17 and c++20.&lt;BR /&gt;&lt;BR /&gt;This may give many problems when collaborating to big projects. I'm not sure, but this may be called "dead code elimination" and I would not expect this "feature" to be activated by default, because it hides bugs. And I actually think that this could be a compiler bug.</description>
    <pubDate>Fri, 28 Feb 2025 23:49:03 GMT</pubDate>
    <dc:creator>Francesco_F</dc:creator>
    <dc:date>2025-02-28T23:49:03Z</dc:date>
    <item>
      <title>unintentional dead code elimination</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1668241#M4311</link>
      <description>&lt;P&gt;I verified an unintentional dead code elimination by the intel oneAPI C++ compiler (2025), working on a Windows machine. Same results compiling the code from Visual Studio, as well from the Intel oneAPI command line.&lt;/P&gt;&lt;P&gt;I think this is a bug (or misconfiguration on Windows?), or at least it should be considered a bug. From a linux machine there is no problem, the compilation error is found (Intel(R) oneAPI DPC++/C++ Compiler 2025.0.0 (2025.0.0.20241008)).&lt;/P&gt;&lt;P&gt;I verified this issue on two different windows machine.&lt;/P&gt;&lt;P&gt;An unintentional procedure like this may hide compilation errors in those part of the code that are not used.&lt;/P&gt;&lt;P&gt;Here is a an example code. From a linux cluster, intel compiler 2025 generate the expected compilation error:&lt;/P&gt;&lt;PRE&gt; error: use of undeclared identifier 'thisbug' &lt;/PRE&gt;&lt;LI-CODE lang="cpp"&gt;#include&amp;lt;array&amp;gt;
#include&amp;lt;iostream&amp;gt;

using my2array = std::array&amp;lt;double, 3&amp;gt;;
using my4array = std::array&amp;lt;double, 4&amp;gt;;

template &amp;lt;typename typey, typename typex&amp;gt;
class myOperator
{
public:
	void operator()(typey&amp;amp; Y, typex&amp;amp; X) const
	{
		// some good stuff
		std::cout &amp;lt;&amp;lt; " We have some good stuff" &amp;lt;&amp;lt; std::endl;
	}

	void operator()(typey&amp;amp; Y, typex&amp;amp; X, double alpha) const
	{
		thisbug = 5;
		std::cout &amp;lt;&amp;lt; " We have some bad stuff" &amp;lt;&amp;lt; std::endl;
	}
	
	
	void myfunction(typey&amp;amp; Y, typex&amp;amp; X)
	{
		thisbug = 5;
		std::cout &amp;lt;&amp;lt; " We have some bad stuff" &amp;lt;&amp;lt; std::endl;
	}

	myOperator(double mydouble, int myint) { // some initial good stuff
	}
};

int main(int argc, char* argv[])
{
	double a{ 5.5 };
	int b{ 2 };
	my2array arr2{ 1.0,3.0 };
	my4array arr4{ 7.0, 2.5, 1.3 };
	myOperator&amp;lt;my2array,my4array&amp;gt; myOp(a, b);

	myOp(arr2, arr4);
	//myOp.myfunction(arr2, arr4);  // uncomment this line to get an error from intel oneAPI compiler (Windows)
	//myOp(arr2, arr4,a);  // uncomment this line to get an error from intel oneAPI compiler (Windows)

	return 0;
}&lt;/LI-CODE&gt;&lt;P&gt;Is this a bug? Are windows and linux intel oneAPI compiler really different?&lt;BR /&gt;Dead code elimination should not be OS dependent... I guess...&lt;/P&gt;&lt;P&gt;any help or comment is welcome.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 08:44:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1668241#M4311</guid>
      <dc:creator>Francesco_F</dc:creator>
      <dc:date>2025-02-20T08:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: unintentional dead code elimination</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1668272#M4312</link>
      <description>&lt;P&gt;update:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;by using&amp;nbsp;ISO C++20 Standard (/std:c++20) the bug is detected even from Windows (flag -std=c++17).&lt;/LI&gt;&lt;LI&gt;by using C++17 Standard the bug is not detected from Windows. From a Linux cluster, using C++17 standards doesn't change: the bug is always detected.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Thu, 20 Feb 2025 09:59:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1668272#M4312</guid>
      <dc:creator>Francesco_F</dc:creator>
      <dc:date>2025-02-20T09:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: unintentional dead code elimination</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1670774#M4316</link>
      <description>&lt;P&gt;Hi,&amp;nbsp; I also see the error on Windows which is expected, could you try the latest compiler ?&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;gt;icpx -V
Intel(R) oneAPI DPC++/C++ Compiler for applications running on Intel(R) 64, Version 2025.0.4 Build 20241205
Copyright (C) 1985-2024 Intel Corporation. All rights reserved.

&amp;gt;icpx test.cpp
C:\tmp\test.cpp:26:3: error: use of undeclared identifier 'thisbug'
   26 |                 thisbug = 5;
      |                 ^
1 error generated.&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 19:35:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1670774#M4316</guid>
      <dc:creator>yzh_intel</dc:creator>
      <dc:date>2025-02-27T19:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: unintentional dead code elimination</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1670787#M4317</link>
      <description>&lt;P&gt;Hi, thank you for the message.&lt;/P&gt;&lt;P&gt;Here is what I see from Intel oneAPI command prompt for Intel 64 for Visual Studio 2022:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;gt;"C:\Program Files (x86)\Intel\oneAPI\compiler\2025.0\bin\icpx.exe" -v
Intel(R) oneAPI DPC++/C++ Compiler 2025.0.4 (2025.0.4.20241205)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files (x86)\Intel\oneAPI\compiler\2025.0\bin\compiler
Configuration file: C:\Program Files (x86)\Intel\oneAPI\compiler\2025.0\bin\compiler\..\icpx.cfg

&amp;gt;"C:\Program Files (x86)\Intel\oneAPI\compiler\2025.0\bin\icpx.exe" test.cpp

&amp;gt;"C:\Program Files (x86)\Intel\oneAPI\compiler\2025.0\bin\icpx.exe" -std=c++17 test.cpp

&amp;gt;"C:\Program Files (x86)\Intel\oneAPI\compiler\2025.0\bin\icpx.exe" -std=c++20 test.cpp
\test.cpp:19:3: error: use of undeclared identifier
      'thisbug'
   19 |                 thisbug = 5;
      |                 ^
\test.cpp:26:3: error: use of undeclared identifier
      'thisbug'
   26 |                 thisbug = 5;
      |                 ^
2 errors generated.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I get the correct compilation error only if I use the flag -std=c++20.&lt;BR /&gt;My cpu is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;gt;wmic cpu get caption, deviceid, name, numberofcores, maxclockspeed, status
Caption DeviceID MaxClockSpeed Name NumberOfCores Status
Intel64 Family 6 Model 170 Stepping 4 CPU0 1300 Intel(R) Core(TM) Ultra 5 125U 12 OK&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;OS:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;OS Name:                   Microsoft Windows 10 Enterprise
OS Version:                10.0.19045 N/A Build 19045
OS Manufacturer:           Microsoft Corporation&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that also your compiler didn't see the error at line 19.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2025 22:10:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1670787#M4317</guid>
      <dc:creator>Francesco_F</dc:creator>
      <dc:date>2025-02-27T22:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: unintentional dead code elimination</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1671108#M4320</link>
      <description>&lt;P&gt;I only uncommented line 43, so the compiler only shows the error on line 26. If I also uncomment ln 44, the error at line 19 will show up.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I tried on a few machines, couldn't see your issue... I don't know if this is a corner case or due to some specific setup in your environment. Maybe someone else can chime in to see if this issue can be reproduced elsewhere.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Feb 2025 17:06:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1671108#M4320</guid>
      <dc:creator>yzh_intel</dc:creator>
      <dc:date>2025-02-28T17:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: unintentional dead code elimination</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1671178#M4323</link>
      <description>Ok. I probably didn't write a clear message. My concern is that WITHOUT uncommenting those lines (i.e. leaving the code as it is), on my two Windows machines the Intel compiler does not give any error. But the errors are clearly there. Those errors are in parts of the code that are not used (that's why I wrote dead code elimination). IF I use the -std=c++20, then the errors are finally found. On a Linux cluster, the errors are correctly seen with both c++17 and c++20.&lt;BR /&gt;&lt;BR /&gt;This may give many problems when collaborating to big projects. I'm not sure, but this may be called "dead code elimination" and I would not expect this "feature" to be activated by default, because it hides bugs. And I actually think that this could be a compiler bug.</description>
      <pubDate>Fri, 28 Feb 2025 23:49:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1671178#M4323</guid>
      <dc:creator>Francesco_F</dc:creator>
      <dc:date>2025-02-28T23:49:03Z</dc:date>
    </item>
    <item>
      <title>Re: unintentional dead code elimination</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1671765#M4325</link>
      <description>&lt;P&gt;Hi, I can reproduce the behavior now, indeed there's some difference between the compilers on linux and windows. But this doesn't hurt anything for your sample code, after all what's deleted is dead code. Can you elaborate more on the scenario when collaborating on big projects and this can be problematic ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Mar 2025 18:20:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1671765#M4325</guid>
      <dc:creator>yzh_intel</dc:creator>
      <dc:date>2025-03-03T18:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: unintentional dead code elimination</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1671954#M4331</link>
      <description>&lt;P&gt;Many thanks again.&lt;/P&gt;&lt;P&gt;So, at this point we may agree that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;- the "dead code" is subjective to the user configuration: the dead code for user A may be non-dead code for user B (especially if A is using windows intel compiler and B is not);&lt;/P&gt;&lt;P&gt;&amp;nbsp;- this kind of windows compiler is hiding bugs (any kind of bugs).&lt;/P&gt;&lt;P&gt;Now, imagine that any of your colleagues is (unintentionally) pushing bugs to the joint branch of the project. When you pull the branch, in the best case you get a compilation error (not the best experience, but at least you see and localize the error), while in the worst case it may last a lot of time (days, weeks, months...) before finding the bug, and in the meantime the bugs may also accumulate. This causes a incredible loss of resources.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Mar 2025 04:36:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1671954#M4331</guid>
      <dc:creator>Francesco_F</dc:creator>
      <dc:date>2025-03-04T04:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: unintentional dead code elimination</title>
      <link>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1672609#M4336</link>
      <description>&lt;P&gt;Hi, thanks for your explanation, this behavior only affects template functions/classes on Windows, it&amp;nbsp;was made in order to be compatible with MS compiler, which unfortunately is not very conformant to C++ standard.&lt;/P&gt;
&lt;P&gt;To enable the errors you would like to see, please add&lt;SPAN&gt;&amp;nbsp;option "-fno-delayed-template-parsing"&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Mar 2025 22:15:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/unintentional-dead-code-elimination/m-p/1672609#M4336</guid>
      <dc:creator>yzh_intel</dc:creator>
      <dc:date>2025-03-05T22:15:14Z</dc:date>
    </item>
  </channel>
</rss>

