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 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

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.

Connectez-vous pour laisser un commentaire.