Issue 153949
Summary catch exception in coroutine on windows produces segfault
Labels
Assignees
Reporter kelbon
    I created pr with reproducing bug, its producing segfault (only on windows)

https://github.com/kelbon/kelcoro/pull/48

```cpp
dd::task<int> foo1(int i) try {
  abc c;
  for (;;) {
    if (i == 42)
      co_return 0;
    co_await std::suspend_always{};

    try {
      bar(c);
 break;
    } catch (std::exception& e) {
      // here `e` already dead, 
 std::cout << '"' << e.what() << '"';
    }
  }
  throw "";
} catch (...) {
  co_return 0;
}
```

Notes:
memory where exception allocated is dead when catch block starts.

Its important that `break` in the try block, even if it is switch `break`, not break for `for` loop

 Access violation reading location 0xFFFFFFFFFFFFFFFF.

corotuine:

<img width="682" height="196" alt="Image" src="" />
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to