<?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 Possible compiler bug in compiling code for MIC (XE SP1 Update3) in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Possible-compiler-bug-in-compiling-code-for-MIC-XE-SP1-Update3/m-p/1053083#M50806</link>
    <description>&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Hi,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;I had logged a similar query here &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://software.intel.com/en-us/forums/topic/517612" target="_blank"&gt;https://software.intel.com/en-us/forums/topic/517612&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;With reference to the code below, it looks like a possible compiler bug in compile code for intel MIC architecture.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;with intel composer xe 2013 sp1 update 3 (trial)&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Compile command :&amp;nbsp;&lt;STRONG&gt;icpc -mmic -std=c++11 &amp;nbsp;-I/home/aniketnp/boost_&lt;/STRONG&gt;with intel composer xe 2013 sp1 update 3 (trial)&amp;nbsp;&lt;STRONG&gt;1_55_0 test.cpp&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include &amp;lt;iostream&amp;gt;
#include &amp;lt;boost/bind.hpp&amp;gt;

using namespace std;

struct Info_t {
 int start;
 int end;
 Info_t(int s=0,int e=0) : start(s), end(e) {  }
};


template&amp;lt;typename Time&amp;gt;
struct my_functor {
 public:
  my_functor() {  }
  my_functor(Time&amp;amp;  time_) : time(time_) {   }

 typedef void result_type;

 template&amp;lt;typename info_t&amp;gt;
 void operator()(const info_t&amp;amp; info1, const info_t&amp;amp; info2) const {
   if ((info2.start &amp;lt; info2.end) &amp;amp;&amp;amp; (info2.end &amp;gt; info1.end) ) {
      if ( info1.end &amp;lt; info2.start)   //NOTE THIS LINE " &amp;lt; " 
       std::cout &amp;lt;&amp;lt; " hi " &amp;lt;&amp;lt; std::endl;
   }
 }

 private:
  Time&amp;amp;  time;
};

int main() {
Info_t  i1(10,2);
Info_t  i2(2,10);
int t = 1;
//auto func = boost::bind( my_functor&amp;lt;int&amp;gt;(t), _1, _2 );
auto func = std::bind( my_functor&amp;lt;int&amp;gt;(t), std::placeholders::_1, std::placeholders::_2 );
func(i1,i2);
return 0;
}
&lt;/PRE&gt;

&lt;P&gt;Gives the error as&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;test.cpp(24): error: expression must have a constant value
        if ( info1.end &amp;lt; info2.start)
                         ^
          detected during:
            instantiation of "_Result std::_Bind&amp;lt;_Functor (_Bound_args...)&amp;gt;::__call&amp;lt;_Result,_Args...,_Indexes...&amp;gt;(std::tuple&amp;lt;_Args...&amp;gt; &amp;amp;&amp;amp;, std::_Index_tuple&amp;lt;_Indexes...&amp;gt;) [with _Functor=my_functor&amp;lt;int&amp;gt;, _Bound_args=&amp;lt;std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;&amp;gt;, _Result=void, _Args=&amp;lt;Info_t &amp;amp;, Info_t &amp;amp;&amp;gt;, _Indexes=&amp;lt;0, 1&amp;gt;]" at line 1205 of "/usr/linux-k1om-4.7/linux-k1om/../x86_64-k1om-linux/include/c++/4.7.0/functional"
            instantiation of "_Result std::_Bind&amp;lt;_Functor (_Bound_args...)&amp;gt;::operator()(_Args &amp;amp;&amp;amp;...) [with _Functor=my_functor&amp;lt;int&amp;gt;, _Bound_args=&amp;lt;std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;&amp;gt;, _Args=&amp;lt;Info_t &amp;amp;, Info_t &amp;amp;&amp;gt;, _Result=void]" at line 39

test.cpp(24): error: this operator is not allowed in a template argument expression
        if ( info1.end &amp;lt; info2.start)
                              ^
          detected during:
            instantiation of "_Result std::_Bind&amp;lt;_Functor (_Bound_args...)&amp;gt;::__call&amp;lt;_Result,_Args...,_Indexes...&amp;gt;(std::tuple&amp;lt;_Args...&amp;gt; &amp;amp;&amp;amp;, std::_Index_tuple&amp;lt;_Indexes...&amp;gt;) [with _Functor=my_functor&amp;lt;int&amp;gt;, _Bound_args=&amp;lt;std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;&amp;gt;, _Result=void, _Args=&amp;lt;Info_t &amp;amp;, Info_t &amp;amp;&amp;gt;, _Indexes=&amp;lt;0, 1&amp;gt;]" at line 1205 of "/usr/linux-k1om-4.7/linux-k1om/../x86_64-k1om-linux/include/c++/4.7.0/functional"
            instantiation of "_Result std::_Bind&amp;lt;_Functor (_Bound_args...)&amp;gt;::operator()(_Args &amp;amp;&amp;amp;...) [with _Functor=my_functor&amp;lt;int&amp;gt;, _Bound_args=&amp;lt;std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;&amp;gt;, _Args=&amp;lt;Info_t &amp;amp;, Info_t &amp;amp;&amp;gt;, _Result=void]" at line 39

test.cpp(24): error: expected a "&amp;gt;"
        if ( info1.end &amp;lt; info2.start)
                                    ^
          detected during:
            instantiation of "_Result std::_Bind&amp;lt;_Functor (_Bound_args...)&amp;gt;::__call&amp;lt;_Result,_Args...,_Indexes...&amp;gt;(std::tuple&amp;lt;_Args...&amp;gt; &amp;amp;&amp;amp;, std::_Index_tuple&amp;lt;_Indexes...&amp;gt;) [with _Functor=my_functor&amp;lt;int&amp;gt;, _Bound_args=&amp;lt;std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;&amp;gt;, _Result=void, _Args=&amp;lt;Info_t &amp;amp;, Info_t &amp;amp;&amp;gt;, _Indexes=&amp;lt;0, 1&amp;gt;]" at line 1205 of "/usr/linux-k1om-4.7/linux-k1om/../x86_64-k1om-linux/include/c++/4.7.0/functional"
            instantiation of "_Result std::_Bind&amp;lt;_Functor (_Bound_args...)&amp;gt;::operator()(_Args &amp;amp;&amp;amp;...) [with _Functor=my_functor&amp;lt;int&amp;gt;, _Bound_args=&amp;lt;std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;&amp;gt;, _Args=&amp;lt;Info_t &amp;amp;, Info_t &amp;amp;&amp;gt;, _Result=void]" at line 39

compilation aborted for test.cpp (code 2)
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;POSSIBLE REASON:&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13.333333015441895px; line-height: normal;"&gt;Compiler interprets this as a member template, because of which it gives expected " &amp;gt; &amp;nbsp;"&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13.333333015441895px; line-height: normal;"&gt;Now if I change the code to this :&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;if ( info1.end &amp;gt; info2.start)    // NOTE THE " &amp;gt; " SIGN&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;There is no error in compiling. IT works fine.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Is this a possible bug for compiling with -mmic flag ? If I compile &lt;STRONG&gt;without&lt;/STRONG&gt;&amp;nbsp; -mmic &amp;nbsp; flag, the compilation does not give any error.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Kindly confirm. Thanks.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Jul 2014 10:15:06 GMT</pubDate>
    <dc:creator>Aniket_P_1</dc:creator>
    <dc:date>2014-07-01T10:15:06Z</dc:date>
    <item>
      <title>Possible compiler bug in compiling code for MIC (XE SP1 Update3)</title>
      <link>https://community.intel.com/t5/Software-Archive/Possible-compiler-bug-in-compiling-code-for-MIC-XE-SP1-Update3/m-p/1053083#M50806</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Hi,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;I had logged a similar query here &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://software.intel.com/en-us/forums/topic/517612" target="_blank"&gt;https://software.intel.com/en-us/forums/topic/517612&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;With reference to the code below, it looks like a possible compiler bug in compile code for intel MIC architecture.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;with intel composer xe 2013 sp1 update 3 (trial)&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Compile command :&amp;nbsp;&lt;STRONG&gt;icpc -mmic -std=c++11 &amp;nbsp;-I/home/aniketnp/boost_&lt;/STRONG&gt;with intel composer xe 2013 sp1 update 3 (trial)&amp;nbsp;&lt;STRONG&gt;1_55_0 test.cpp&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include &amp;lt;iostream&amp;gt;
#include &amp;lt;boost/bind.hpp&amp;gt;

using namespace std;

struct Info_t {
 int start;
 int end;
 Info_t(int s=0,int e=0) : start(s), end(e) {  }
};


template&amp;lt;typename Time&amp;gt;
struct my_functor {
 public:
  my_functor() {  }
  my_functor(Time&amp;amp;  time_) : time(time_) {   }

 typedef void result_type;

 template&amp;lt;typename info_t&amp;gt;
 void operator()(const info_t&amp;amp; info1, const info_t&amp;amp; info2) const {
   if ((info2.start &amp;lt; info2.end) &amp;amp;&amp;amp; (info2.end &amp;gt; info1.end) ) {
      if ( info1.end &amp;lt; info2.start)   //NOTE THIS LINE " &amp;lt; " 
       std::cout &amp;lt;&amp;lt; " hi " &amp;lt;&amp;lt; std::endl;
   }
 }

 private:
  Time&amp;amp;  time;
};

int main() {
Info_t  i1(10,2);
Info_t  i2(2,10);
int t = 1;
//auto func = boost::bind( my_functor&amp;lt;int&amp;gt;(t), _1, _2 );
auto func = std::bind( my_functor&amp;lt;int&amp;gt;(t), std::placeholders::_1, std::placeholders::_2 );
func(i1,i2);
return 0;
}
&lt;/PRE&gt;

&lt;P&gt;Gives the error as&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;test.cpp(24): error: expression must have a constant value
        if ( info1.end &amp;lt; info2.start)
                         ^
          detected during:
            instantiation of "_Result std::_Bind&amp;lt;_Functor (_Bound_args...)&amp;gt;::__call&amp;lt;_Result,_Args...,_Indexes...&amp;gt;(std::tuple&amp;lt;_Args...&amp;gt; &amp;amp;&amp;amp;, std::_Index_tuple&amp;lt;_Indexes...&amp;gt;) [with _Functor=my_functor&amp;lt;int&amp;gt;, _Bound_args=&amp;lt;std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;&amp;gt;, _Result=void, _Args=&amp;lt;Info_t &amp;amp;, Info_t &amp;amp;&amp;gt;, _Indexes=&amp;lt;0, 1&amp;gt;]" at line 1205 of "/usr/linux-k1om-4.7/linux-k1om/../x86_64-k1om-linux/include/c++/4.7.0/functional"
            instantiation of "_Result std::_Bind&amp;lt;_Functor (_Bound_args...)&amp;gt;::operator()(_Args &amp;amp;&amp;amp;...) [with _Functor=my_functor&amp;lt;int&amp;gt;, _Bound_args=&amp;lt;std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;&amp;gt;, _Args=&amp;lt;Info_t &amp;amp;, Info_t &amp;amp;&amp;gt;, _Result=void]" at line 39

test.cpp(24): error: this operator is not allowed in a template argument expression
        if ( info1.end &amp;lt; info2.start)
                              ^
          detected during:
            instantiation of "_Result std::_Bind&amp;lt;_Functor (_Bound_args...)&amp;gt;::__call&amp;lt;_Result,_Args...,_Indexes...&amp;gt;(std::tuple&amp;lt;_Args...&amp;gt; &amp;amp;&amp;amp;, std::_Index_tuple&amp;lt;_Indexes...&amp;gt;) [with _Functor=my_functor&amp;lt;int&amp;gt;, _Bound_args=&amp;lt;std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;&amp;gt;, _Result=void, _Args=&amp;lt;Info_t &amp;amp;, Info_t &amp;amp;&amp;gt;, _Indexes=&amp;lt;0, 1&amp;gt;]" at line 1205 of "/usr/linux-k1om-4.7/linux-k1om/../x86_64-k1om-linux/include/c++/4.7.0/functional"
            instantiation of "_Result std::_Bind&amp;lt;_Functor (_Bound_args...)&amp;gt;::operator()(_Args &amp;amp;&amp;amp;...) [with _Functor=my_functor&amp;lt;int&amp;gt;, _Bound_args=&amp;lt;std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;&amp;gt;, _Args=&amp;lt;Info_t &amp;amp;, Info_t &amp;amp;&amp;gt;, _Result=void]" at line 39

test.cpp(24): error: expected a "&amp;gt;"
        if ( info1.end &amp;lt; info2.start)
                                    ^
          detected during:
            instantiation of "_Result std::_Bind&amp;lt;_Functor (_Bound_args...)&amp;gt;::__call&amp;lt;_Result,_Args...,_Indexes...&amp;gt;(std::tuple&amp;lt;_Args...&amp;gt; &amp;amp;&amp;amp;, std::_Index_tuple&amp;lt;_Indexes...&amp;gt;) [with _Functor=my_functor&amp;lt;int&amp;gt;, _Bound_args=&amp;lt;std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;&amp;gt;, _Result=void, _Args=&amp;lt;Info_t &amp;amp;, Info_t &amp;amp;&amp;gt;, _Indexes=&amp;lt;0, 1&amp;gt;]" at line 1205 of "/usr/linux-k1om-4.7/linux-k1om/../x86_64-k1om-linux/include/c++/4.7.0/functional"
            instantiation of "_Result std::_Bind&amp;lt;_Functor (_Bound_args...)&amp;gt;::operator()(_Args &amp;amp;&amp;amp;...) [with _Functor=my_functor&amp;lt;int&amp;gt;, _Bound_args=&amp;lt;std::_Placeholder&amp;lt;1&amp;gt;, std::_Placeholder&amp;lt;2&amp;gt;&amp;gt;, _Args=&amp;lt;Info_t &amp;amp;, Info_t &amp;amp;&amp;gt;, _Result=void]" at line 39

compilation aborted for test.cpp (code 2)
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;POSSIBLE REASON:&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13.333333015441895px; line-height: normal;"&gt;Compiler interprets this as a member template, because of which it gives expected " &amp;gt; &amp;nbsp;"&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13.333333015441895px; line-height: normal;"&gt;Now if I change the code to this :&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;if ( info1.end &amp;gt; info2.start)    // NOTE THE " &amp;gt; " SIGN&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;There is no error in compiling. IT works fine.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Is this a possible bug for compiling with -mmic flag ? If I compile &lt;STRONG&gt;without&lt;/STRONG&gt;&amp;nbsp; -mmic &amp;nbsp; flag, the compilation does not give any error.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Kindly confirm. Thanks.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jul 2014 10:15:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Possible-compiler-bug-in-compiling-code-for-MIC-XE-SP1-Update3/m-p/1053083#M50806</guid>
      <dc:creator>Aniket_P_1</dc:creator>
      <dc:date>2014-07-01T10:15:06Z</dc:date>
    </item>
    <item>
      <title>Thank you for the additional</title>
      <link>https://community.intel.com/t5/Software-Archive/Possible-compiler-bug-in-compiling-code-for-MIC-XE-SP1-Update3/m-p/1053084#M50807</link>
      <description>&lt;P&gt;Thank you for the additional details. This is a variant of the error reported earlier with the 13.0 compiler here (https://software.intel.com/en-us/forums/topic/517612) so I will post any further information from Development in the earlier cited posting.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jul 2014 10:53:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Possible-compiler-bug-in-compiling-code-for-MIC-XE-SP1-Update3/m-p/1053084#M50807</guid>
      <dc:creator>Kevin_D_Intel</dc:creator>
      <dc:date>2014-07-01T10:53:05Z</dc:date>
    </item>
  </channel>
</rss>

