<?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 GCC Cilk Plus: warning: unused variable 'sf_01; in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/GCC-Cilk-Plus-warning-unused-variable-sf-01/m-p/998248#M29035</link>
    <description>&lt;P&gt;Hello, and thank you for your time.&lt;/P&gt;

&lt;P&gt;I've just installed a fresh version of GCC Cilk Plus, and my first simple program is presenting an anomalous warning.&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;/home/david/cilkplus-install/bin/g++ -Wall -O0 -fcilkplus -o hello_cilk hello_cilk.cpp -Wl,-rpath=/home/david/cilkplus-install/lib64  -lcilkrts -lpthread -ldl

In function ‘int fib(int)’:
cc1plus: warning: unused variable ‘sf_01’ [-Wunused-variable]
In function ‘int main(int, char**)’:
cc1plus: warning: unused variable ‘sf_02’ [-Wunused-variable]
&lt;/PRE&gt;

&lt;P&gt;I've seen this warning mentioned in some other threads in this forum and other places on the internet, but I never found a definite cause or resolution. I'm curious if the Cilk Plus team has an explanation/resolution (or at least an intuition that this won't cause a problem).&amp;nbsp;&lt;/P&gt;

&lt;P&gt;The program in question:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;//Hello to GCC Cilk!
#include &amp;lt;iostream&amp;gt;

const int iterations = 1000000;

void adder( int&amp;amp; a){
        for(int i=0; i &amp;lt; iterations; i++)
                a++;
}

void subber( int&amp;amp; b){
        for(int i=0; i &amp;lt; iterations; i++)
                b--;
}

int fib( int x ){

        if(x &amp;lt;= 1){
                return x;
        }else{
                int y = _Cilk_spawn fib(x-1);
                int z = _Cilk_spawn fib(x-2);
                _Cilk_sync;

                return y + z;
        }
}

int main( int argc, char* argv[]){

        //Classic Cilk test
        std::cout &amp;lt;&amp;lt; "Hello Cilk!" &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; fib(30) &amp;lt;&amp;lt; std::endl; //Should be 832040


        //Generate a race condition just for fun        
        int race = 0;
        _Cilk_spawn adder(race);
        subber(race);
        _Cilk_sync;
        std::cout &amp;lt;&amp;lt; race &amp;lt;&amp;lt; std::endl;

        return 0;
}

&lt;/PRE&gt;

&lt;P&gt;The only thing I've noticed is that the warning seems to be associated with the presence of spawn/sync statements in the code, not their invocation. If you comment out the call to fib(30) you'll still get both warnings. If you additionally comment out the definition of fib() then one of the warnings goes away. If you comment out the spawn adder() and following sync statement, the other warning will go away.&lt;/P&gt;

&lt;P&gt;This doesn't appear to have affected correctness, fib returns the correct result and the variable race is indeed a proper race condition.&amp;nbsp;&lt;SPAN style="font-size: 13.0080003738403px; line-height: 19.5120010375977px;"&gt;&amp;nbsp;Is there any kind of self-validation included with GCC Cilk Plus?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Thank you for your time!&lt;BR /&gt;
	David&lt;/P&gt;

&lt;P&gt;GCC and Linux versions:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;/home/david/cilkplus-install/bin/g++ -v

Using built-in specs.
COLLECT_GCC=/home/david/cilkplus-install/bin/g++
COLLECT_LTO_WRAPPER=/home/david/cilkplus-install/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/david/gcc-cilkrts/cilkplus-gcc/configure --prefix=/home/david/cilkplus-install --enable-languages=c,c++
Thread model: posix
gcc version 4.9.0 20130520 (experimental) (GCC) 


uname -a

Linux 3.16.0-33-generic #44~14.04.1-Ubuntu SMP Fri Mar 13 10:33:29 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux&lt;/PRE&gt;

&lt;P&gt;&lt;BR /&gt;
	I'm not sure how to find the Cilk version number anymore. SVN revision:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;URL: svn://gcc.gnu.org/svn/gcc/branches/cilkplus
​Revision: 221750
Last Changed Author: bviyer
Last Changed Rev: 203896
Last Changed Date: 2013-10-21 10:31:38 -0500 (Mon, 21 Oct 2013)
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 28 Mar 2015 17:12:18 GMT</pubDate>
    <dc:creator>dsf423</dc:creator>
    <dc:date>2015-03-28T17:12:18Z</dc:date>
    <item>
      <title>GCC Cilk Plus: warning: unused variable 'sf_01;</title>
      <link>https://community.intel.com/t5/Software-Archive/GCC-Cilk-Plus-warning-unused-variable-sf-01/m-p/998248#M29035</link>
      <description>&lt;P&gt;Hello, and thank you for your time.&lt;/P&gt;

&lt;P&gt;I've just installed a fresh version of GCC Cilk Plus, and my first simple program is presenting an anomalous warning.&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;/home/david/cilkplus-install/bin/g++ -Wall -O0 -fcilkplus -o hello_cilk hello_cilk.cpp -Wl,-rpath=/home/david/cilkplus-install/lib64  -lcilkrts -lpthread -ldl

In function ‘int fib(int)’:
cc1plus: warning: unused variable ‘sf_01’ [-Wunused-variable]
In function ‘int main(int, char**)’:
cc1plus: warning: unused variable ‘sf_02’ [-Wunused-variable]
&lt;/PRE&gt;

&lt;P&gt;I've seen this warning mentioned in some other threads in this forum and other places on the internet, but I never found a definite cause or resolution. I'm curious if the Cilk Plus team has an explanation/resolution (or at least an intuition that this won't cause a problem).&amp;nbsp;&lt;/P&gt;

&lt;P&gt;The program in question:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;//Hello to GCC Cilk!
#include &amp;lt;iostream&amp;gt;

const int iterations = 1000000;

void adder( int&amp;amp; a){
        for(int i=0; i &amp;lt; iterations; i++)
                a++;
}

void subber( int&amp;amp; b){
        for(int i=0; i &amp;lt; iterations; i++)
                b--;
}

int fib( int x ){

        if(x &amp;lt;= 1){
                return x;
        }else{
                int y = _Cilk_spawn fib(x-1);
                int z = _Cilk_spawn fib(x-2);
                _Cilk_sync;

                return y + z;
        }
}

int main( int argc, char* argv[]){

        //Classic Cilk test
        std::cout &amp;lt;&amp;lt; "Hello Cilk!" &amp;lt;&amp;lt; std::endl;
        std::cout &amp;lt;&amp;lt; fib(30) &amp;lt;&amp;lt; std::endl; //Should be 832040


        //Generate a race condition just for fun        
        int race = 0;
        _Cilk_spawn adder(race);
        subber(race);
        _Cilk_sync;
        std::cout &amp;lt;&amp;lt; race &amp;lt;&amp;lt; std::endl;

        return 0;
}

&lt;/PRE&gt;

&lt;P&gt;The only thing I've noticed is that the warning seems to be associated with the presence of spawn/sync statements in the code, not their invocation. If you comment out the call to fib(30) you'll still get both warnings. If you additionally comment out the definition of fib() then one of the warnings goes away. If you comment out the spawn adder() and following sync statement, the other warning will go away.&lt;/P&gt;

&lt;P&gt;This doesn't appear to have affected correctness, fib returns the correct result and the variable race is indeed a proper race condition.&amp;nbsp;&lt;SPAN style="font-size: 13.0080003738403px; line-height: 19.5120010375977px;"&gt;&amp;nbsp;Is there any kind of self-validation included with GCC Cilk Plus?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Thank you for your time!&lt;BR /&gt;
	David&lt;/P&gt;

&lt;P&gt;GCC and Linux versions:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;/home/david/cilkplus-install/bin/g++ -v

Using built-in specs.
COLLECT_GCC=/home/david/cilkplus-install/bin/g++
COLLECT_LTO_WRAPPER=/home/david/cilkplus-install/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/david/gcc-cilkrts/cilkplus-gcc/configure --prefix=/home/david/cilkplus-install --enable-languages=c,c++
Thread model: posix
gcc version 4.9.0 20130520 (experimental) (GCC) 


uname -a

Linux 3.16.0-33-generic #44~14.04.1-Ubuntu SMP Fri Mar 13 10:33:29 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux&lt;/PRE&gt;

&lt;P&gt;&lt;BR /&gt;
	I'm not sure how to find the Cilk version number anymore. SVN revision:&lt;/P&gt;

&lt;PRE class="brush:bash;"&gt;URL: svn://gcc.gnu.org/svn/gcc/branches/cilkplus
​Revision: 221750
Last Changed Author: bviyer
Last Changed Rev: 203896
Last Changed Date: 2013-10-21 10:31:38 -0500 (Mon, 21 Oct 2013)
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Mar 2015 17:12:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/GCC-Cilk-Plus-warning-unused-variable-sf-01/m-p/998248#M29035</guid>
      <dc:creator>dsf423</dc:creator>
      <dc:date>2015-03-28T17:12:18Z</dc:date>
    </item>
    <item>
      <title>Hi David,</title>
      <link>https://community.intel.com/t5/Software-Archive/GCC-Cilk-Plus-warning-unused-variable-sf-01/m-p/998249#M29036</link>
      <description>&lt;P&gt;Hi David,&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Is there any specific reason you are using the Cilk Plus branch? To my&amp;nbsp;best knowledge,&amp;nbsp;it is old and not actively maintained.&amp;nbsp;All of Cilk features (with a few exceptions such as&amp;nbsp;Cilk view support)&amp;nbsp;have been&amp;nbsp;merged into GCC mainline. GCC 5.0 should have all of the features&amp;nbsp;and GCC 4.9 should have almost all features except _Cilk_for.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
	Balaji V. Iyer.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Mar 2015 17:22:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/GCC-Cilk-Plus-warning-unused-variable-sf-01/m-p/998249#M29036</guid>
      <dc:creator>Balaji_I_Intel</dc:creator>
      <dc:date>2015-03-28T17:22:24Z</dc:date>
    </item>
    <item>
      <title>Quote:Balaji Iyer (Intel)</title>
      <link>https://community.intel.com/t5/Software-Archive/GCC-Cilk-Plus-warning-unused-variable-sf-01/m-p/998250#M29037</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Balaji Iyer (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Hi David,&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Is there any specific reason you are using the Cilk Plus branch? To my&amp;nbsp;best knowledge,&amp;nbsp;it is old and not actively maintained.&amp;nbsp;All of Cilk features (with a few exceptions such as&amp;nbsp;Cilk view support)&amp;nbsp;have been&amp;nbsp;merged into GCC mainline. GCC 5.0 should have all of the features&amp;nbsp;and GCC 4.9 should have almost all features except _Cilk_for.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Balaji V. Iyer.&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;No there's not. That's good to know!&lt;/P&gt;

&lt;P&gt;I Google searched "gcc cilk plus" and the &lt;A href="https://www.cilkplus.org/build-gcc-cilkplus"&gt;Cilk Plus build instructions&lt;/A&gt; were the first result that popped up, which directs you to download the Cilk Plus branch. I should have seen the repository "last changed date" was 2013!&lt;/P&gt;

&lt;P&gt;I'll update again if there's the same problem with GCC 5.0.&lt;/P&gt;

&lt;P&gt;Thanks Balaji&lt;/P&gt;</description>
      <pubDate>Sat, 28 Mar 2015 17:29:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/GCC-Cilk-Plus-warning-unused-variable-sf-01/m-p/998250#M29037</guid>
      <dc:creator>dsf423</dc:creator>
      <dc:date>2015-03-28T17:29:20Z</dc:date>
    </item>
    <item>
      <title>Even with gcc 5.0 updated 2</title>
      <link>https://community.intel.com/t5/Software-Archive/GCC-Cilk-Plus-warning-unused-variable-sf-01/m-p/998251#M29038</link>
      <description>&lt;P&gt;Even with gcc 5.0 updated 2 days ago, it still says __sec_reduce_add(b&lt;I&gt;*c&lt;M&gt;) is invalid built-in, and there's an ICE according to bugzilla 63336. It seems like a lot of effort and waiting to figure this stuff out.&lt;/M&gt;&lt;/I&gt;&lt;/P&gt;

&lt;P&gt;It's interesting that the posted Intel advice still didn't recommend gcc releases until you replied just now.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Mar 2015 20:18:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/GCC-Cilk-Plus-warning-unused-variable-sf-01/m-p/998251#M29038</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2015-03-28T20:18:00Z</dc:date>
    </item>
    <item>
      <title>I submitted another pr about</title>
      <link>https://community.intel.com/t5/Software-Archive/GCC-Cilk-Plus-warning-unused-variable-sf-01/m-p/998252#M29039</link>
      <description>&lt;P&gt;I submitted another pr about cilkplus reducer ice which was confirmed. I guess there may be no interest in fixing the problem with array notation &amp;nbsp;and potentially overlapping pointers.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Apr 2015 11:59:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/GCC-Cilk-Plus-warning-unused-variable-sf-01/m-p/998252#M29039</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2015-04-11T11:59:40Z</dc:date>
    </item>
  </channel>
</rss>

