Cilkscreen and __sync_add_and_fetch

Cilkscreen and __sync_add_and_fetch

The following simple program causes cilkscreen to report an error.

#include
#include
#include

volatile int x;
void race(int b)
{
__sync_add_and_fetch(&x, b);
}

void race1(int b)
{
__sync_add_and_fetch(&x, b);
}

void test(void)
{
cilk_spawn race(1);
cilk_spawn race1(2);
}

int main(int argc, char *argv[])
{
x = 0;
test();

printf("done: x = %d\\n", x);
return 0;
}

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hello Zardosht!

I can reproduce this problem with Cilkscreen and I've submitteda problem report on this. I'll update the thread when we have a resolution. What kind of urgency do you have here for this problem?

Brandon Hewitt
Technical Consulting Engineer

For 1:1 technical support: http://premier.intel.com

Software Product Support info: http://www.intel.com/software/support

Hello Brandon,

At the moment, we are using the _InterlockedXXX functions as a replacement, so this is not terribly urgent.

-Zardosht

Leave a Comment

Please sign in to add a comment. Not a member? Join today