Same issue here. After trying everyone's suggestions from this thread and coming up dry, I finally narrowed down the needle-in-a-haystack.
In my case it was a Swift Package. Debug builds built fine, but Release builds (with optimizations) caused the Swift compiler to crash with the same stack trace and error: Abort trap: 6 as others have mentioned.
The culprit? A single missing import statement in one of the package's .swift files.
To elaborate the particulars:
PackageA (crashed compiler) has PackageB as a dependency, which in turn has PackageC as a dependency.
All three packages show up in the dependency pool of course.
PackageA was accessing methods from PackageC without actually using an import PackageC statement (possibly by way of PackageB exporting types from PackageC in some of its interfaces).
The missing import statement was forgotten because compilation succeeded in Debug builds and development and testing was only ever done in a Debug build. It wasn't until production Release builds of an application that imported PackageA that the compiler crash mysteriously cropped up with very little context.
Topic:
Programming Languages
SubTopic:
Swift
Tags: