{"data":{"allPost":{"edges":[{"node":{"slug":"/post/2025/03/when-the-swift-compiler-deleted-code-in-stdlib-9067","title":"当 Swift 编译器删除了标准库中的代码 - 记修复 Swift 6 中的冗余 Load 指令消除优化器","subtitle":"","isPublished":true,"createdTime":"2025-03-09T00:00:00.000Z","lastModifiedTime":null,"license":null,"tags":["Swift","Compiler"],"category":"Programming","file":{"childMdx":{"excerpt":"最新更新：苹果已接受该问题的修复。最终解决方案在相关代码所有者 review 后进行了调整。 蛇年春节假期前，一位同事向我展示了一个由 use-after-free（释放后使用）错误导致的神秘崩溃。最近，我有时间深入研究这个问题，并发现崩溃是由 Swift 编译器的错误编译引起的。下面是最小复现代码，必须使用  -Osize  优化级别编译。我们可以通过在编译过程中启用地址检查器（address sanitizer）来检测 use-after-free 问题。 有趣的是，将  AutoreleasingUnsafeMutablePointer…"}}}}]}},"pageContext":{"slug":"/zh-Hans/tag/compiler","locale":{"identifier":"zh-Hans","slug":"/zh-Hans"},"title":"Tags > Compiler","showsPageTitle":true,"keywords":["WeZZard","Pieces of My Soul"],"description":"","items":["46abd102-d678-5362-9d51-00ffd4a02f90"],"paginationInfo":{"basePath":"/zh-Hans/tag/compiler","pageIndex":0,"pagesCount":1,"previousPageTitle":"Earlier Posts","nextPageTitle":"Later Posts"}}}