Skip to content

C++ interop: Cross-module serialization is unable to deserialize synthesized base member calls #74578

Open
@hyp

Description

@hyp

Description

When C++ interop is enable, a type might synthesize a Swift method to represent a base member call, that invokes the synthesized C++ member function. This reference can be serialized as an x-reference in SIL, and at deserialization time this reference can't be resolved.

Reproduction

A type that derives from another type that has a base member, and that base member is used in a cross-module context.

Stack dump

1.      Swift version 6.0-dev (LLVM 25f401da89fc02a, Swift c5b7596477f37b1)
2.      Compiling with effective version 5.10
3.      While evaluating request ASTLoweringRequest(Lowering AST to SIL for module FirebaseAuth)
4.      While deserializing SIL function "_ZNK14swift_firebase15swift_cxx_shims8firebase6FutureIiE49__synthesizedBaseCall___synthesizedBaseCall_errorEv"
5.      *** DESERIALIZATION FAILURE ***
*** If any module named here was modified in the SDK, please delete the ***
*** new swiftmodule files from the SDK and keep only swiftinterfaces.   ***
module 'FirebaseAuth', builder version '6.0(5.10)/Swift version 6.0-dev (LLVM 25f401da89fc02a, Swift c5b7596477f37b1)', built from source against SDK , non-resilient, loaded from 'CMakeFiles\FirebaseAuth.dir\Sources\FirebaseAuth\FirebaseAuth+Swift.swift.swiftmodule'
result not found (__synthesizedBaseCall___synthesizedBaseCall_error)
Cross-reference to module '__ObjC'
... swift_firebase
... swift_cxx_shims
... firebase
... Future
... (in c:@N@swift_firebase@N@swift_cxx_shims@N@firebase@S@Future>#I)
... __synthesizedBaseCall___synthesizedBaseCall_error
... with type (swift_firebase.swift_cxx_shims.firebase.Future<CInt>) -> () -> Int32


Exception Code: 0x80000003
 #0 0x00007ff6ed866995 HandleAbort (S:\b\5\bin\swiftc.exe+0x7676995)
 #1 0x00007ff914d8e6d5 (C:\Windows\System32\ucrtbase.dll+0x7e6d5)
 #2 0x00007ff914d8f6e1 (C:\Windows\System32\ucrtbase.dll+0x7f6e1)
 #3 0x00007ff6e79a4109 swift::ModuleFileSharedCore::fatal(class llvm::Error) const (S:\b\5\bin\swiftc.exe+0x17b4109)
 #4 0x00007ff6e7ac4be0 swift::ModuleFile::diagnoseFatal(class llvm::Error) const (S:\b\5\bin\swiftc.exe+0x18d4be0)
 #5 0x00007ff6e7ac505e swift::ModuleFile::fatal(class llvm::Error) const (S:\b\5\bin\swiftc.exe+0x18d505e)
 #6 0x00007ff6e7ac925b swift::ModuleFile::getDecl(class llvm::PointerEmbeddedInt<unsigned int, 31>) (S:\b\5\bin\swiftc.exe+0x18d925b)
 #7 0x00007ff6e7a6f2c9 swift::SILDeserializer::readSILFunctionChecked(class llvm::PointerEmbeddedInt<unsigned int, 31>, class swift::SILFunction *, class llvm::StringRef, bool, bool) (S:\b\5\bin\swiftc.exe+0x187f2c9)
 #8 0x00007ff6e7a64fac swift::SILDeserializer::getAllSILFunctions(void) (S:\b\5\bin\swiftc.exe+0x1874fac)
 #9 0x00007ff6e7a23806 swift::SerializedSILLoader::getAllForModule(class swift::Identifier, class swift::FileUnit *) (S:\b\5\bin\swiftc.exe+0x1833806)
#10 0x00007ff6e6fe7e99 swift::ASTLoweringRequest::evaluate(class swift::Evaluator &, struct swift::ASTLoweringDescriptor) const (S:\b\5\bin\swiftc.exe+0xdf7e99)
#11 0x00007ff6e6ff2cd6 swift::SimpleRequest<class swift::ASTLoweringRequest, (struct swift::ASTLoweringDescriptor), 9>::evaluateRequest(class swift::ASTLoweringRequest const &, class swift::Evaluator &) (S:\b\5\bin\swiftc.exe+0xe02cd6)
#12 0x00007ff6e6fdd2d3 swift::Evaluator::getResultUncached<class swift::ASTLoweringRequest, class `class std::unique_ptr<class swift::SILModule, struct std::default_delete<class swift::SILModule>> __cdecl swift::evaluateOrFatal<class swift::ASTLoweringRequest>(class swift::Evaluator &, class swift::ASTLoweringRequest)'::`2'::<lambda_1>>(class swift::ASTLoweringRequest const &, class `class std::unique_ptr<class swift::SILModule, struct std::default_delete<class swift::SILModule>> __cdecl swift::evaluateOrFatal<class swift::ASTLoweringRequest>(class swift::Evaluator &, class swift::ASTLoweringRequest)'::`2'::<lambda_1>) (S:\b\5\bin\swiftc.exe+0xded2d3)
#13 0x00007ff6e6ff1381 swift::performASTLowering(class swift::ModuleDecl *, class swift::Lowering::TypeConverter &, class swift::SILOptions const &, class swift::IRGenOptions const *) (S:\b\5\bin\swiftc.exe+0xe01381)
#14 0x00007ff6e679e728 swift::performCompileStepsPostSema(class swift::CompilerInstance &, int &, class swift::FrontendObserver *) (S:\b\5\bin\swiftc.exe+0x5ae728)
#15 0x00007ff6e679d4d7 std::basic_stringbuf<char, struct std::char_traits<char>, class std::allocator<char>>::pbackfail(int) (S:\b\5\bin\swiftc.exe+0x5ad4d7)
#16 0x00007ff6e679da4e std::basic_stringbuf<char, struct std::char_traits<char>, class std::allocator<char>>::pbackfail(int) (S:\b\5\bin\swiftc.exe+0x5ada4e)
#17 0x00007ff6e679ff30 swift::performFrontend(class llvm::ArrayRef<char const *>, char const *, void *, class swift::FrontendObserver *) (S:\b\5\bin\swiftc.exe+0x5aff30)
#18 0x00007ff6e65d4c26 llvm::SmallVectorTemplateBase<char const *, 1>::push_back(char const *) (S:\b\5\bin\swiftc.exe+0x3e4c26)
#19 0x00007ff6e65d47a3 swift::mainEntry(int, char const **) (S:\b\5\bin\swiftc.exe+0x3e47a3)
#20 0x00007ff6ed8e7920 invoke_main D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78:0
#21 0x00007ff6ed8e7920 __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
#22 0x00007ff915a0257d (C:\Windows\System32\KERNEL32.DLL+0x1257d)
#23 0x00007ff91714af28 (C:\Windows\SYSTEM32\ntdll.dll+0x5af28)


### Expected behavior

Should deserialize correctly

### Environment

Swift main

### Additional information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.c++ interopFeature: Interoperability with C++crashBug: A crash, i.e., an abnormal termination of software

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions