Skip to content

[SR-16016] [Regression] Swift 5.6 SIL crash when reference C struct type #58277

Open
@swift-ci

Description

@swift-ci
Previous ID SR-16016
Radar None
Original Reporter fejfighter (JIRA User)
Type Bug

Attachment: Download

Additional Detail from JIRA
Votes 1
Component/s Compiler, swift
Labels Bug, ClangImporter, CompilerCrash
Assignee None
Priority Medium

md5: d18315ee45113b5b8bb6a7972e4acbbf

Issue Description:

After upgrading to swift 5.6, a simple Swift package wrapping some C code now crashes during SIL generation. This worked correctly in 5.5 and so should be considered a regression.

I have attached project of identical structure to demonstrate.

The C Sources are shared across many projects/platforms and are dropped in, so may change contents for a build but the structure is fixed. SPM seems the only way to isolate that code.

swift testswift testBuilding for debugging...[1/2] Compiling crcpack packet.cerror: compile command failed due to signal 11 (use -v to see invocation)[2/4] Emitting module crcpackTestsPlease submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.Stack dump:0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/jeff.walsh/dev/crcpack/Tests/crcpackTests/crcpackTests.swift -emit-dependencies-path /Users/jeff.walsh/dev/crcpack/.build/x86_64-apple-macosx/debug/crcpackTests.build/crcpackTests.d -emit-reference-dependencies-path /Users/jeff.walsh/dev/crcpack/.build/x86_64-apple-macosx/debug/crcpackTests.build/crcpackTests.swiftdeps -target x86_64-apple-macosx11.0 -enable-objc-interop -stack-check -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -I /Users/jeff.walsh/dev/crcpack/.build/x86_64-apple-macosx/debug -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -enable-testing -g -module-cache-path /Users/jeff.walsh/dev/crcpack/.build/x86_64-apple-macosx/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -new-driver-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -Xcc -fmodule-map-file=/Users/jeff.walsh/dev/crcpack/Sources/crcpack/include/module.modulemap -Xcc -I -Xcc /Users/jeff.walsh/dev/crcpack/Sources/crcpack/include -module-name crcpackTests -target-sdk-version 12.3 -parse-as-library -o /Users/jeff.walsh/dev/crcpack/.build/x86_64-apple-macosx/debug/crcpackTests.build/crcpackTests.swift.o -index-store-path /Users/jeff.walsh/dev/crcpack/.build/x86_64-apple-macosx/debug/index/store -index-system-modules1. Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)2. Compiling with the current language version3. While evaluating request IRGenRequest(IR Generation for file "/Users/jeff.walsh/dev/crcpack/Tests/crcpackTests/crcpackTests.swift")4. While emitting IR SIL function "@$s12crcpackTestsAAC11testExampleyyKF". for 'testExample()' (at /Users/jeff.walsh/dev/crcpack/Tests/crcpackTests/crcpackTests.swift:14:5)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           0x0000000110255de7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 391  swift-frontend           0x0000000110254e38 llvm::sys::RunSignalHandlers() + 2482  swift-frontend           0x0000000110256440 SignalHandler(int) + 2883  libsystem_platform.dylib 0x00007ff819515dfd _sigtramp + 294  libsystem_platform.dylib 0x0000000000000010 _sigtramp + 184466033701561718245  swift-frontend           0x000000010b481b37 (anonymous namespace)::StructTypeInfoBase<(anonymous namespace)::LoadableClangRecordTypeInfo, swift::irgen::LoadableTypeInfo, (anonymous namespace)::ClangFieldInfo>::projectFieldAddress(swift::irgen::IRGenFunction&, swift::irgen::Address, swift::SILType, swift::VarDecl*) const + 1676  swift-frontend           0x000000010b500891 swift::SILInstructionVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::SILInstruction*) + 304497  swift-frontend           0x000000010b4f3e32 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 105308  swift-frontend           0x000000010b39c6d3 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&) + 18759  swift-frontend           0x000000010b4be889 swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 951310 swift-frontend           0x000000010b4f11ec swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::IRGenRequest const&, swift::Evaluator&) + 20411 swift-frontend           0x000000010b4c947c llvm::Expected<swift::IRGenRequest::OutputType> swift::Evaluator::getResultUncached<swift::IRGenRequest>(swift::IRGenRequest const&) + 82812 swift-frontend           0x000000010b4c316c 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**) + 34813 swift-frontend           0x000000010af8c3b3 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*) + 249914 swift-frontend           0x000000010af7e261 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 1523315 swift-frontend           0x000000010af3d5d4 swift::mainEntry(int, char const**) + 110816 dyld                     0x000000011a11d51e start + 462error: fatalError

Metadata

Metadata

Assignees

No one assigned

    Labels

    IRGenLLVM IR generationbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.c interopFeature: Interoperability with CcompilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareregressionswift 5.6

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions