Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-14261] -O crashing compiler: fatal error encountered while reading from module 'Foundation' #56621

Open
swift-ci opened this issue Feb 19, 2021 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-14261
Radar rdar://problem/74523836
Original Reporter Davidee (JIRA User)
Type Bug
Environment

Xcode 12.5 beta 2, Big Sur. Does not repro in latest trunk snapshot or swift-5.4-DEVELOPMENT-SNAPSHOT-2021-02-12-a, might already be fixed? Hopefully the fix can make it into Xcode 12.5 beta 3.

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 93739af9610fadf29cc7cd7014c6b654

Issue Description:

git clone https://github.com/apple/swift-protobuf.git

cd swift-protobuf

swift build -v -c debug -Xswiftc -O

Crash:

<unknown>:0: error: fatal error encountered while reading from module 'Foundation'; please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project
<unknown>:0: note: module 'Foundation' full misc version is '5.4(5.4)/Apple Swift version 5.4 (swiftlang-1205.0.24.6 clang-1205.0.19.54)'

*

**

      • DESERIALIZATION FAILURE (please include this section in any bug report) ***
        top-level value not found
        Cross-reference to module 'Darwin'
        ... memcmp
        ... with type (UnsafeRawPointer, UnsafeRawPointer, Int) -> Int32

Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:

<args omitted>

1.  Apple Swift version 5.4 (swiftlang-1205.0.24.6 clang-1205.0.19.54)
2.  While evaluating request ExecuteSILPipelineRequest(Run pipelines { PrepareOptimizationPasses, EarlyModulePasses, HighLevel,Function+EarlyLoopOpt, HighLevel,Module+StackPromote, Serialize, MidLevel,Function, ClosureSpecialize, LowLevel,Function, LateLoopOpt, SIL Debug Info Generator } on SIL for SwiftProtobuf.SwiftProtobuf)
3.  While running pass #&#8203;48 SILModuleTransform "PerformanceSILLinker".
4.  While deserializing SIL function "$s10Foundation4DataV2eeoiySbAC_ACtFZSbSWXEfU_"
5.  While deserializing SIL function "memcmp"
0  swift-frontend           0x00000001052860f5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift-frontend           0x00000001052850e8 llvm::sys::RunSignalHandlers() + 248
2  swift-frontend           0x00000001052866b6 SignalHandler(int) + 262
3  libsystem_platform.dylib 0x00007fff20609d7d _sigtramp + 29
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603339972960928
5  libsystem_c.dylib        0x00007fff20518720 abort + 120
6  swift-frontend           0x0000000100ff4644 swift::ModuleFileSharedCore::fatal(llvm::Error) + 100
7  swift-frontend           0x0000000100f79e08 swift::ModuleFile::fatal(llvm::Error) + 2600
8  swift-frontend           0x0000000100fb6f31 swift::SILDeserializer::readSILFunctionChecked(llvm::PointerEmbeddedInt<unsigned int, 31>, swift::SILFunction*, llvm::StringRef, bool, bool) + 10113
9  swift-frontend           0x0000000100fb4674 swift::SILDeserializer::getFuncForReference(llvm::StringRef, swift::SILType) + 916
10 swift-frontend           0x0000000100fcbba1 swift::SILDeserializer::readSILInstruction(swift::SILFunction*, swift::SILBuilder&, unsigned int, llvm::SmallVectorImpl<unsigned long long>&) + 80177
11 swift-frontend           0x0000000100fb646a swift::SILDeserializer::readSILFunctionChecked(llvm::PointerEmbeddedInt<unsigned int, 31>, swift::SILFunction*, llvm::StringRef, bool, bool) + 7354
12 swift-frontend           0x0000000100fdbe7b swift::SILDeserializer::lookupSILFunction(swift::SILFunction*, bool) + 875
13 swift-frontend           0x000000010108974a swift::SILLinkerVisitor::maybeAddFunctionToWorklist(swift::SILFunction*) + 122
14 swift-frontend           0x00000001010899df swift::SILLinkerVisitor::processFunction(swift::SILFunction*) + 239
15 swift-frontend           0x0000000100dfeccd (anonymous namespace)::SILLinker::run() + 285
16 swift-frontend           0x0000000100cc86a2 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 1794
17 swift-frontend           0x0000000100ce301c swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 60
18 swift-frontend           0x0000000100cd0925 llvm::Expected<swift::ExecuteSILPipelineRequest::OutputType> swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest>(swift::ExecuteSILPipelineRequest const&) + 1077
19 swift-frontend           0x0000000100cd3a5b swift::runSILOptimizationPasses(swift::SILModule&) + 427
20 swift-frontend           0x000000010060771d swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 1213
21 swift-frontend           0x00000001004bded8 performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1208
22 swift-frontend           0x00000001004afd52 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6370
23 swift-frontend           0x00000001004362c2 main + 1266
24 libdyld.dylib            0x00007fff205e0621 start + 1
25 libdyld.dylib            0x000000000000008f start + 18446603339973130863
@benlangmuir
Copy link
Member

@swift-ci create

@swift-ci
Copy link
Collaborator Author

Comment by David Goldman (JIRA)

Note, the bug doesn't seem to trigger when WMO is enabled (hence why the repro is a debug build, SPM uses WMO for release builds), -O without WMO somehow triggers this here

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants