Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

segmentation fault with simple cilk_for loop (gcc cilkplus branch)

cmeerw
Beginner
713 Views

Using the gcc cilkplus branch, I consistently get a segmentation fault for a very simple example with a cilk_for loop:

#include

void do_work(int i)
{ }

int main(int argc, char* argv[])
{
int n = 10;

cilk_for(int i = 0; i != n; ++i)
{
do_work(i);
}
}

but if I add a dummy cilk_spawn/cilk_sync to that example, it starts to work as expected:

#include

void dummy()
{ }

void do_work(int i)
{ }

int main(int argc, char* argv[])
{
int n = 10;

cilk_spawn dummy();
cilk_sync;

cilk_for(int i = 0; i != n; ++i)
{
do_work(i);
}
}

So I am assuming that cilk_for is relyin on some runtime initialisation that's only being done by cilk_spawn/cilk_sync...

0 Kudos
3 Replies
Pablo_H_Intel
Employee
713 Views
Thanks for the bug report. We have reproduced the problem and are fairly certain of the cause. We'll let you know when a fix is a available.

-Pablo
0 Kudos
Balaji_I_Intel
Employee
713 Views
Hello Cmeerw,
I think we have fixed this problem. Please checkout the latest Cilkplus GCC version and let us know if you still have problems.

Thanks,

Balaji V. Iyer.
0 Kudos
cmeerw
Beginner
713 Views
Thanks Pablo and Balaji - it's working now.
0 Kudos
Reply