Skip to content

[SR-13777] Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create #56174

@troughton

Description

@troughton
Previous ID SR-13777
Radar rdar://problem/70686871
Original Reporter @troughton
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, IRGen
Assignee None
Priority Medium

md5: 5ab9ed27fab2c899feb8916d9e76b345

Issue Description:

When compiling swift-atomics (https://github.com/apple/swift-atomics) at commit ccce007 against the 2020-10-24 toolchain snapshot for macOS 10.15.7, compilation fails with the following output while compiling AtomicBool.swift:

Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/llvm-project/llvm/lib/IR/Instructions.cpp, line 2873.

PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.

Stack dump:

0. Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2020-10-24-a.xctoolchain/usr/bin/swift-frontend -frontend -c ...

1. Apple Swift version 5.3-dev (LLVM 56a74d3, Swift 246fe46)

2. While evaluating request IRGenRequest(IR Generation for file "/Users/Thomas/Library/Developer/Xcode/DerivedData/LlamaEngine-gbjurpnqehampfbabsmsqakihbyd/SourcePackages/checkouts/swift-atomics/Sources/Atomics/autogenerated/AtomicBool.swift")

3. While emitting IR SIL function "@$sSb7AtomicsE20AtomicRepresentationV8_storageSo8_sa_Boolavg".

for getter for _storage (at /Users/Thomas/Library/Developer/Xcode/DerivedData/LlamaEngine-gbjurpnqehampfbabsmsqakihbyd/SourcePackages/checkouts/swift-atomics/Sources/Atomics/autogenerated/AtomicBool.swift:27:18)

0 swift-frontend 0x000000010a854bd5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37

1 swift-frontend 0x000000010a853e35 llvm::sys::RunSignalHandlers() + 85

2 swift-frontend 0x000000010a8551a6 SignalHandler(int) + 262

3 libsystem_platform.dylib 0x00007fff6b69a5fd _sigtramp + 29

4 libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338714077728

5 libsystem_c.dylib 0x00007fff6b570808 abort + 120

6 libsystem_c.dylib 0x00007fff6b56fac6 err + 0

7 swift-frontend 0x000000010bcdc9c3 llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*) (.cold.1) + 35

8 swift-frontend 0x000000010a6d643d llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*) + 637

9 swift-frontend 0x000000010862d03c llvm::IRBuilderBase::CreateCast(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&) + 60

10 swift-frontend 0x0000000106311bf1 swift::irgen::NativeConventionSchema::mapFromNative(swift::irgen::IRGenModule&, swift::irgen::IRGenFunction&, swift::irgen::Explosion&, swift::SILType) const + 449

11 swift-frontend 0x000000010646a8d6 (anonymous namespace)::IRGenSILFunction::emitSILFunction() + 5142

12 swift-frontend 0x0000000106468f67 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 1527

13 swift-frontend 0x0000000106350682 swift::irgen::IRGenerator::emitGlobalTopLevel(std::_1::vector<std::1::basic_string<char, std::1::char_traits<char>, std::1::allocator<char> >, std::1::allocator<std::1::basic_string<char, std::1::char_traits<char>, std::_1::allocator<char> > > > const&) + 818

14 swift-frontend 0x0000000106432f43 swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 1971

15 swift-frontend 0x00000001064685bd swift::GeneratedModule swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)9>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const + 157

16 swift-frontend 0x00000001064684de swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::IRGenRequest const&, swift::Evaluator&) + 14

17 swift-frontend 0x000000010643cd49 llvm::Expected<swift::IRGenRequest::OutputType> swift::Evaluator::getResultUncached<swift::IRGenRequest>(swift::IRGenRequest const&) + 345

18 swift-frontend 0x00000001064359ce llvm::Expected<swift::IRGenRequest::OutputType> swift::Evaluator::operator()<swift::IRGenRequest, (void*)0>(swift::IRGenRequest const&) + 110

19 swift-frontend 0x0000000106435b79 swift::performIRGeneration(swift::FileUnit*, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::_1::unique_ptr<swift::SILModule, std::_1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::GlobalVariable**) + 313

20 swift-frontend 0x000000010616f73e 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*) + 2526

21 swift-frontend 0x000000010616ea1e performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 350

22 swift-frontend 0x0000000106166dab swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4827

23 swift-frontend 0x00000001060fd5f2 main + 866

24 libdyld.dylib 0x00007fff6b4a1cc9 start + 1

error: Abort trap: 6 (in target 'Atomics' from project 'swift-atomics')

Metadata

Metadata

Assignees

No one assigned

    Labels

    IRGenLLVM IR generationbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions