swift
58c28c51 - [cxx-interop] Fix miscompilation of Optional structs with FRTs

Commit
20 hours ago
[cxx-interop] Fix miscompilation of Optional structs with FRTs When an optional is initialized, Swift generates a zero-initialized stack allocation for the optional and uses an assign operation to store the payload into this memory. The assign will destroy the previously owned payload. In this case the previously owned payload is the zero initialized struct, IRGen was not aware that we should not call release on this zero initialized memory unconditionally. This PR makes sure we emit a null check when we emit a consume for an optional. rdar://171258910
Author
Gabor Horvath
Committer
Gabor Horvath
Parents
Loading