Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cilk_scope without braces fails to sync #319

Open
VoxSciurorum opened this issue Feb 25, 2025 · 0 comments · May be fixed by #320
Open

cilk_scope without braces fails to sync #319

VoxSciurorum opened this issue Feb 25, 2025 · 0 comments · May be fixed by #320
Assignees
Labels
bug Something isn't working

Comments

@VoxSciurorum
Copy link
Contributor

This test program

#include <stdio.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
  cilk_scope for (int i = 0; i < argc; ++i)
    cilk_spawn { fprintf(stdout, "%s\n", argv[i]); usleep(100); }
  return 0;
}

crashes with an assertion failure when run on more than one thread:

cilk assertion failed: __cilkrts_synced(sf)

Adding braces around the body of the cilk_scope fixes the problem.

The usleep call is to make sure work is stolen.

@VoxSciurorum VoxSciurorum added the bug Something isn't working label Feb 25, 2025
@VoxSciurorum VoxSciurorum self-assigned this Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant