opencilk-project icon indicating copy to clipboard operation
opencilk-project copied to clipboard

Out of order exceptions might call std::terminate

Open VoxSciurorum opened this issue 4 months ago • 0 comments
trafficstars

(This is to officially document a known bug.)

This code with well-defined serial behavior may call std::terminate when run on multiple threads:

int main(int argc, char *argv[])
{
  try {
    cilk_spawn throw 0;
    throw "1";
  } catch (int x) {
    return x;
  }
  return 1;
}

If the second throw executes it will find no handler. In serial execution the first throw always prevents the second from executing.

The search for a handler can not definitively say "no handler" until all logically earlier code paths have suspended.

VoxSciurorum avatar Jun 24 '25 17:06 VoxSciurorum