by over-allocating and emitting alignTo code to adjust the frame start address.
Motivation: on a lot of machines, malloc returns >=std::max_align_t (usually just 16) aligned heap regardless of the coro frame's preferred alignment (usually specified using alignas() on the promise or some local variables). For non-coroutine-related context, this is handled by calling overloaded operator new where an alignment could be specified. For coroutine, spec here https://eel.is/c++draft/dcl.fct.def.coroutine#9.1 suggested that the alignment argument is not considered during name lookup.
Mathias Stearn and @lewissbaker suggested this is the proper workaround before the issue is addressed by the spec.
One example showing the issue: https://gcc.godbolt.org/z/rGzaco
Okay, so you're implicitly increasing the coroutine size to allow you to round up to get an aligned frame. But how do you round back down to get the actual pointer that you need to delete? This just doesn't work.
You really ought to just be using the aligned operator new instead when the required alignment is too high. If that means checking the alignment "dynamically" before calling operator new / operator delete, so be it. In practice, it will not be dynamic because lowering will replace the coro.align call with a constant, at which point the branch will be foldable.
I don't know what to suggest if the aligned operator new isn't reliably available on the target OS. You could outline a function to pick the best allocator/deallocator, I suppose.