[clang] [clang][CodeGen] Coroutine exception slots can't be stored in the frame (PR #242924)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 17:51:05 PST 2026


================
@@ -480,6 +480,17 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) {
     }
   }
 
+  // The exception slots of a coroutine need to be stored outside of the
+  // coroutine frame because they can be triggered before the coroutine frame
+  // exists. Notable examples are failing during the construction of the promise
+  // itself, and in future through contract assertion failures.
+  if (isCoroutine()) {
+    for (llvm::Value *Slot : {ExceptionSlot, (llvm::Value *)EHSelectorSlot})
----------------
ojhunt wrote:

oh, sorry and the cast is just the standard initializer list problem :-/

- I can make that change I think it's trying to be too clever :D

https://github.com/llvm/llvm-project/pull/242924


More information about the cfe-commits mailing list