segmentation fault with simple cilk_for loop (gcc cilkplus branch)

segmentation fault with simple cilk_for loop (gcc cilkplus branch)

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...

4 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

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

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.

Thanks Pablo and Balaji - it's working now.

登陆并发表评论。