Uploaded image for project: 'Swift'
  1. Swift
  2. SR-12944

Segmentation fault: 11 when parsing KVO

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Compiler
    • Labels:
    • Environment:

      Xcode Version 11.5 (11E608c)

      Also tested with master toolchain from May 26, same crash.

      Description

      I've created a dummy KVO on "description". This is a trick to make KVO subclass but never actually emit anything; this however crashes the Swift compiler. I expect that this is either compiled or errors. (I fully realize this is a weird example, but it's fairly small - I tried to reproduce it into an even smaller example and failed, still wanted to report)

      Code is open source: https://github.com/steipete/InterposeKit/tree/peter/segfault-11-swift-5-2-4

      Stack dump:

      0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/steipete/Projects/InterposeKit/Sources/InterposeKit/ClassTask.swift /Users/steipete/Projects/InterposeKit/Sources/InterposeKit/InterposeKit.swift -primary-file /Users/steipete/Projects/InterposeKit/Sources/InterposeKit/ObjectTask.swift -emit-module-path /Users/steipete/Builds/InterposeKit-diayhexpyguubtenduutqzfjxvbu/Build/Intermediates.noindex/InterposeKit.build/Debug-iphonesimulator/InterposeKit.build/Objects-normal/x86_64/ObjectTask~partial.swiftmodule -emit-module-doc-path /Users/steipete/Builds/InterposeKit-diayhexpyguubtenduutqzfjxvbu/Build/Intermediates.noindex/InterposeKit.build/Debug-iphonesimulator/InterposeKit.build/Objects-normal/x86_64/ObjectTask~partial.swiftdoc -emit-module-source-info-path /Users/steipete/Builds/InterposeKit-diayhexpyguubtenduutqzfjxvbu/Build/Intermediates.noindex/InterposeKit.build/Debug-iphonesimulator/InterposeKit.build/Objects-normal/x86_64/ObjectTask~partial.swiftsourceinfo -serialize-diagnostics-path /Users/steipete/Builds/InterposeKit-diayhexpyguubtenduutqzfjxvbu/Build/Intermediates.noindex/InterposeKit.build/Debug-iphonesimulator/InterposeKit.build/Objects-normal/x86_64/ObjectTask.dia -emit-dependencies-path /Users/steipete/Builds/InterposeKit-diayhexpyguubtenduutqzfjxvbu/Build/Intermediates.noindex/InterposeKit.build/Debug-iphonesimulator/InterposeKit.build/Objects-normal/x86_64/ObjectTask.d -emit-reference-dependencies-path /Users/steipete/Builds/InterposeKit-diayhexpyguubtenduutqzfjxvbu/Build/Intermediates.noindex/InterposeKit.build/Debug-iphonesimulator/InterposeKit.build/Objects-normal/x86_64/ObjectTask.swiftdeps -target x86_64-apple-ios11.0-simulator -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.5.sdk -I /Users/steipete/Builds/InterposeKit-diayhexpyguubtenduutqzfjxvbu/Build/Products/Debug-iphonesimulator -I /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/lib -F /Users/steipete/Builds/InterposeKit-diayhexpyguubtenduutqzfjxvbu/Build/Products/Debug-iphonesimulator -F /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -enable-testing -g -module-cache-path /Users/steipete/Builds/ModuleCache.noindex -profile-generate -profile-coverage-mapping -swift-version 5 -enforce-exclusivity=checked -Onone -D SWIFT_PACKAGE -D DEBUG -D Xcode -serialize-debugging-options -Xcc -working-directory -Xcc /Users/steipete/Projects/InterposeKit -enable-anonymous-context-mangled-names -Xcc -I/Users/steipete/Builds/InterposeKit-diayhexpyguubtenduutqzfjxvbu/Build/Intermediates.noindex/InterposeKit.build/Debug-iphonesimulator/InterposeKit.build/swift-overrides.hmap -Xcc -I/Users/steipete/Builds/InterposeKit-diayhexpyguubtenduutqzfjxvbu/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/steipete/Builds/InterposeKit-diayhexpyguubtenduutqzfjxvbu/Build/Intermediates.noindex/InterposeKit.build/Debug-iphonesimulator/InterposeKit.build/DerivedSources-normal/x86_64 -Xcc -I/Users/steipete/Builds/InterposeKit-diayhexpyguubtenduutqzfjxvbu/Build/Intermediates.noindex/InterposeKit.build/Debug-iphonesimulator/InterposeKit.build/DerivedSources/x86_64 -Xcc -I/Users/steipete/Builds/InterposeKit-diayhexpyguubtenduutqzfjxvbu/Build/Intermediates.noindex/InterposeKit.build/Debug-iphonesimulator/InterposeKit.build/DerivedSources -Xcc -DSWIFT_PACKAGE -Xcc -DDEBUG=1 -module-name InterposeKit -o /Users/steipete/Builds/InterposeKit-diayhexpyguubtenduutqzfjxvbu/Build/Intermediates.noindex/InterposeKit.build/Debug-iphonesimulator/InterposeKit.build/Objects-normal/x86_64/ObjectTask.o -index-store-path /Users/steipete/Builds/InterposeKit-diayhexpyguubtenduutqzfjxvbu/Index/DataStore -index-system-modules

      1. Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)

      2. While emitting IR SIL function "@$sSo7NSProxyC11descriptionSSvpyXlTK".

      for expression at [/Users/steipete/Projects/InterposeKit/Sources/InterposeKit/ObjectTask.swift:52:17 - line:52:35] RangeText="\.objectToObserve."

      0  swift                    0x00000001089274ea PrintStackTraceSignalHandler(void*) + 42

      1  swift                    0x0000000108926cc0 SignalHandler(int) + 352

      2  libsystem_platform.dylib 0x00007fff708ff5fd _sigtramp + 29

      3  libsystem_platform.dylib 0x00007fdbfc033200 _sigtramp + 2339585056

      4  swift                    0x00000001087accd9 llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*) + 873

      5  swift                    0x00000001048b974b swift::SILInstructionVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::SILInstruction*) + 33211

      6  swift                    0x00000001048ae053 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 8835

      7  swift                    0x0000000104764336 swift::irgen::IRGenerator::emitLazyDefinitions() + 8790

      8  swift                    0x000000010488c704 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::_1::unique_ptr<swift::SILModule, std::_1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**) + 1284

      9  swift                    0x0000000104683a5f performCompileStepsPostSILGen(swift::CompilerInstance&, swift::CompilerInvocation&, std::_1::unique_ptr<swift::SILModule, std::_1::default_delete<swift::SILModule> >, bool, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, bool, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 4255

      10 swift                    0x0000000104678eba swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 48426

      11 swift                    0x00000001045f0b73 main + 1283

      12 libdyld.dylib            0x00007fff70706cc9 start + 1

      error: Segmentation fault: 11 (in target 'InterposeKit' from project 'InterposeKit')

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            steipete Peter Steinberger
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated: