Skip to content

Assertion failed: (hasValidSignatureForEmbedded(f)), function addLazyFunction at GenDecl.cpp:1494. #80947

Open
@Vithanco

Description

@Vithanco

Description

I build the attached code with
swift build -c release -Xswiftc -whole-module-optimization -Xswiftc -enable-experimental-feature -Xswiftc Embedded
and get

  1. Apple Swift version 6.1 (swift-6.1-RELEASE)
  2. Compiling with the current language version
  3. While emitting IR SIL function "@$s6VGraph5GraphPAAE19detectCyclesAsEdges10upToLengthSaySay1EQzGGSi_tFAA08WeightedB0CyAA10IdentifierVyAA5_NodeVGAA4EdgeVG_Tg5".
    for 'detectCyclesAsEdges(upToLength:)' (at /Users/kkn/private/swift/vithanco/VGraph/Sources/VGraph/SwfitGraph/Cycle.swift:58:5)
  4. While lowering reference to SIL function "@$sSa6appendyyxnFTf4gn_n".
    for 'append(_:)' (in module 'Swift')
  5. While lowering address of SIL function "@$sSa6appendyyxnFTf4gn_n".
    for 'append(_:)' (in module 'Swift')
    Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it):
    0 swift-frontend 0x0000000107c77884 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
    1 swift-frontend 0x0000000107c75fb0 llvm::sys::RunSignalHandlers() + 112
    2 swift-frontend 0x0000000107c77ec8 SignalHandler(int) + 292
    3 libsystem_platform.dylib 0x000000018d4ef624 _sigtramp + 56
    4 libsystem_pthread.dylib 0x000000018d4b588c pthread_kill + 296
    5 libsystem_c.dylib 0x000000018d3bec60 abort + 124
    6 swift-frontend 0x00000001040d0d84 ASSERT_help() + 0
    7 swift-frontend 0x0000000102d08e84 swift::irgen::IRGenerator::addLazyFunction(swift::SILFunction*) + 376
    8 swift-frontend 0x0000000102d0b5e4 swift::irgen::IRGenModule::getAddrOfSILFunction(swift::SILFunction*, swift::ForDefinition_t, bool, bool) + 1424
    9 swift-frontend 0x0000000102e82f2c (anonymous namespace)::IRGenSILFunction::visitFunctionRefBaseInst(swift::FunctionRefBaseInst*) + 264
    10 swift-frontend 0x0000000102e696e4 (anonymous namespace)::IRGenSILFunction::visitSILBasicBlock(swift::SILBasicBlock*) + 15812
    11 swift-frontend 0x0000000102e64920 (anonymous namespace)::IRGenSILFunction::emitSILFunction() + 8852
    12 swift-frontend 0x0000000102e620ec swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 1812
    13 swift-frontend 0x0000000102d06ca0 swift::irgen::IRGenerator::emitGlobalTopLevel(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>>> const&) + 728
    14 swift-frontend 0x0000000102e17620 swift::performIRGeneration(swift::ModuleDecl*, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_deleteswift::SILModule>, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>>, llvm::GlobalVariable**) + 1480
    15 swift-frontend 0x000000010298c950 generateIR(swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_deleteswift::SILModule>, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, llvm::GlobalVariable*&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>>) + 272
    16 swift-frontend 0x00000001029895d4 performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_deleteswift::SILModule>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1372
    17 swift-frontend 0x0000000102988d98 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1328
    18 swift-frontend 0x0000000102994b50 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 164
    19 swift-frontend 0x000000010298a74c performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 716
    20 swift-frontend 0x0000000102989f68 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2228
    21 swift-frontend 0x000000010276d8f0 swift::mainEntry(int, char const**) + 3064
    22 dyld 0x000000018d116b4c start + 6000

Reproduction

I run swift build -c release -Xswiftc -whole-module-optimization -Xswiftc -enable-experimental-feature -Xswiftc Embedded

VGraph.zip

My swift version:
swift --version
Apple Swift version 6.1 (swift-6.1-RELEASE)
Target: arm64-apple-macosx15.0

Expected behavior

no failed assertion

Environment

on a macOS 15.4.1

Additional information

reach out if you want to know more.

Metadata

Metadata

Assignees

No one assigned

    Labels

    IRGenLLVM IR generationbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.embeddedEmbedded Swift

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions