<?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 Problem with array-notation in a function in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Problem-with-array-notation-in-a-function/m-p/741979#M806</link>
    <description>I am able to reproduce this and I will get back to you as soon as I find a fix. Thank you very much forreporting this bug.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Balaji V. Iyer.</description>
    <pubDate>Tue, 05 Jun 2012 15:51:17 GMT</pubDate>
    <dc:creator>Balaji_I_Intel</dc:creator>
    <dc:date>2012-06-05T15:51:17Z</dc:date>
    <item>
      <title>Problem with array-notation in a function</title>
      <link>https://community.intel.com/t5/Software-Archive/Problem-with-array-notation-in-a-function/m-p/741976#M803</link>
      <description>Hi,&lt;DIV&gt;i recently read about the Arraynotation in Cilk and tried to devise a test function of my own: I have an array of length 10, filled with ones and want to change that to twos.&lt;/DIV&gt;&lt;DIV&gt;Now, when i do that in my main()-function using array notation it's not a problem. However, if i declare my own function and use the array as a parameter, i get a compiler error saying&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;arraynotation.cpp: In function int foo(int*):&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;arraynotation.cpp:8:4: internal compiler error: Segmentation fault&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt; A[:] = 2;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;  ^&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I am not very experienced using cilk/c++ but this seems to me like there is a bug in the compiler. Or is itin generalforbidden to use this arraynotation outside of the main function (which would not make sense). I used Fedora 16 w/ the cilkplus-branch of the gcc; this is the code i used:&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;[cpp]int foo(int A[10]) {
	A[:] = 2;
	return(0);
}


int main(int argc, char** argv)
{
    int A[10];
    A[:]  = 1;
    int b = foo(&amp;amp;A[0]);

    return 0;
    
}[/cpp] &lt;/DIV&gt;</description>
      <pubDate>Mon, 04 Jun 2012 19:47:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Problem-with-array-notation-in-a-function/m-p/741976#M803</guid>
      <dc:creator>leifblaese</dc:creator>
      <dc:date>2012-06-04T19:47:11Z</dc:date>
    </item>
    <item>
      <title>Problem with array-notation in a function</title>
      <link>https://community.intel.com/t5/Software-Archive/Problem-with-array-notation-in-a-function/m-p/741977#M804</link>
      <description>Hello Leifblase,&lt;BR /&gt; In GCC, to use the ":" syntax, the compiler should know the size of array to find the length. When you pass Ainto foo, it is getting A as a pointer and that iswhy it is failing.&lt;BR /&gt;&lt;BR /&gt;So, please replace theA[:] = 2 with A[0:10] = 2&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Balaji V. Iyer.</description>
      <pubDate>Mon, 04 Jun 2012 20:00:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Problem-with-array-notation-in-a-function/m-p/741977#M804</guid>
      <dc:creator>Balaji_I_Intel</dc:creator>
      <dc:date>2012-06-04T20:00:32Z</dc:date>
    </item>
    <item>
      <title>Problem with array-notation in a function</title>
      <link>https://community.intel.com/t5/Software-Archive/Problem-with-array-notation-in-a-function/m-p/741978#M805</link>
      <description>[cpp]
[/cpp] Thank you very much. That was obviously the problem.&lt;BR /&gt;&lt;BR /&gt;When I replaced the code as you suggested, it did not work at first, however. Only after inserting three lines to generate some output (see below) it compiled. Without the for-loop i get a compiler-error saying&lt;BR /&gt;&lt;BR /&gt;array-notation-test.cpp: In function int foo(int*):&lt;BR /&gt;array-notation-test.cpp:8:20: internal compiler error: in gimplify_expr, at gimplify.c:7877&lt;BR /&gt;&lt;BR /&gt;I am somewhat confused about this, because the for-loop has obviously nothing to do with the array code. Maybe i will post an answer here when i figure out what exactly happened. &lt;BR /&gt;&lt;BR /&gt;Just to clarify, this works now:&lt;BR /&gt;&lt;BR /&gt;[cpp]int foo(int A[10]) {  
	A[0:10] = 2; 
	for (int i = 0; i &amp;lt; 10; i++) {
		cout &amp;lt;&amp;lt; A&lt;I&gt;;
	}
	cout &amp;lt;&amp;lt; endl;
	return(0);  
}   [/cpp]&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Leif&lt;/I&gt;</description>
      <pubDate>Tue, 05 Jun 2012 10:09:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Problem-with-array-notation-in-a-function/m-p/741978#M805</guid>
      <dc:creator>leifblaese</dc:creator>
      <dc:date>2012-06-05T10:09:10Z</dc:date>
    </item>
    <item>
      <title>Problem with array-notation in a function</title>
      <link>https://community.intel.com/t5/Software-Archive/Problem-with-array-notation-in-a-function/m-p/741979#M806</link>
      <description>I am able to reproduce this and I will get back to you as soon as I find a fix. Thank you very much forreporting this bug.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Balaji V. Iyer.</description>
      <pubDate>Tue, 05 Jun 2012 15:51:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Problem-with-array-notation-in-a-function/m-p/741979#M806</guid>
      <dc:creator>Balaji_I_Intel</dc:creator>
      <dc:date>2012-06-05T15:51:17Z</dc:date>
    </item>
    <item>
      <title>Problem with array-notation in a function</title>
      <link>https://community.intel.com/t5/Software-Archive/Problem-with-array-notation-in-a-function/m-p/741980#M807</link>
      <description>Hello Leif,&lt;BR /&gt; I have fixed the bug and submitted a patch (&lt;A href="http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00317.html"&gt;http://gcc.gnu.org/ml/gcc-patches/2012-06/msg00317.html&lt;/A&gt;). The patch is already checked into Cilkplus gcc. &lt;BR /&gt;&lt;BR /&gt;Thank again!&lt;BR /&gt;&lt;BR /&gt;Balaji V. Iyer.</description>
      <pubDate>Tue, 05 Jun 2012 17:10:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Problem-with-array-notation-in-a-function/m-p/741980#M807</guid>
      <dc:creator>Balaji_I_Intel</dc:creator>
      <dc:date>2012-06-05T17:10:43Z</dc:date>
    </item>
    <item>
      <title>Problem with array-notation in a function</title>
      <link>https://community.intel.com/t5/Software-Archive/Problem-with-array-notation-in-a-function/m-p/741981#M808</link>
      <description>Thank you, it works fine now.</description>
      <pubDate>Wed, 06 Jun 2012 14:04:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Problem-with-array-notation-in-a-function/m-p/741981#M808</guid>
      <dc:creator>leifblaese</dc:creator>
      <dc:date>2012-06-06T14:04:19Z</dc:date>
    </item>
  </channel>
</rss>

