You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swift-ci opened this issue
Jun 6, 2020
· 2 comments
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of software
(Same as attached example, Open workspace and build, observe crash)
Crash Log:
IntToPtr source must be an integral
%63 = inttoptr %swift.type* %4 to %objc_class*, !dbg !801
in function $s12InterposeKit10ObjectTaskC24addSuperTrampolineMethod33_94A0A856956E4F416118E85197FF51B1LL8subclass6methodyyXlXp_s13OpaquePointerVtFyyXl_So13__va_list_tagVtcfU_
<unknown>:0: error: fatal error encountered during compilation; please file a bug report with your project and the crash log
<unknown>:0: note: Broken function found, compilation aborted!
1. Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
2. Running pass 'Module Verifier' on function '@"$s12InterposeKit10ObjectTaskC24addSuperTrampolineMethod33_94A0A856956E4F416118E85197FF51B1LL8subclass6methodyyXlXp_s13OpaquePointerVtFyyXl_So13__va_list_tagVtcfU_"'
0 swift 0x0000000107d1a4ea PrintStackTraceSignalHandler(void*) + 42
1 swift 0x0000000107d19cc0 SignalHandler(int) + 352
let superStruct = objc_super(receiver: obj as! Unmanaged<AnyObject>, super_class: subclass)
If I fake the same class in Swift, it "works":
struct objc_super_fake { public var receiver: Unmanaged<AnyObject> public var super_class: AnyClass var superStruct = objc_super_fake(receiver: obj as! Unmanaged<AnyObject>, super_class: subclass) let realSuperStruct = unsafeBitCast(superStruct, to: objc_super.self)
Bit this is cursed and I'm relying on bits being accidentally arranged in the same way.
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of software
Attachment: Download
Environment
Xcode 10.15.5, also tested with master toolchain May 26.
Additional Detail from JIRA
md5: 3e7f03aa625dca142230d1633d571f87
Issue Description:
This Swift code causes an Abort Trap 6. I can run ~the same code successfully in Objective-C.
let sendSuper2 = dlsym(handle, "objc_msgSendSuper2");
let block: @convention(block) (AnyObject, va_list) -> Void = { obj, vaList in
let superStruct = objc_super(receiver: obj as! Unmanaged<AnyObject>, super_class: subclass)
unsafeBitCast(sendSuper2, to: (@convention(c) (objc_super, Selector, va_list) -> Void).self)(superStruct, self.selector, vaList)
Project is open source: https://github.com/steipete/InterposeKit/tree/peter/abort-trap-6-swift-5-2-4-va-arg
(Same as attached example, Open workspace and build, observe crash)
Crash Log:
IntToPtr source must be an integral
%63 = inttoptr %swift.type* %4 to %objc_class*, !dbg !801
in function $s12InterposeKit10ObjectTaskC24addSuperTrampolineMethod33_94A0A856956E4F416118E85197FF51B1LL8subclass6methodyyXlXp_s13OpaquePointerVtFyyXl_So13__va_list_tagVtcfU_
<unknown>:0: error: fatal error encountered during compilation; please file a bug report with your project and the crash log
<unknown>:0: note: Broken function found, compilation aborted!
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. Running pass 'Module Verifier' on function '@"$s12InterposeKit10ObjectTaskC24addSuperTrampolineMethod33_94A0A856956E4F416118E85197FF51B1LL8subclass6methodyyXlXp_s13OpaquePointerVtFyyXl_So13__va_list_tagVtcfU_"'
0 swift 0x0000000107d1a4ea PrintStackTraceSignalHandler(void*) + 42
1 swift 0x0000000107d19cc0 SignalHandler(int) + 352
2 libsystem_platform.dylib 0x00007fff708ff5fd _sigtramp + 29
3 libsystem_platform.dylib 0x00007ffeec23a4c0 _sigtramp + 2073276128
4 libsystem_c.dylib 0x00007fff707d5808 abort + 120
5 swift 0x0000000103a6e6b1 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_1::__invoke(void*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) + 1137
6 swift 0x0000000107c955c6 llvm::report_fatal_error(llvm::Twine const&, bool) + 278
7 swift 0x0000000107c954ab llvm::report_fatal_error(char const*, bool) + 43
8 swift 0x0000000107c17423 (anonymous namespace)::VerifierLegacyPass::runOnFunction(llvm::Function&) + 115
9 swift 0x0000000107bb77f9 llvm::FPPassManager::runOnFunction(llvm::Function&) + 1609
10 swift 0x0000000107bc0e70 llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&) + 112
11 swift 0x0000000107bc0d9d llvm::legacy::FunctionPassManager::run(llvm::Function&) + 365
12 swift 0x0000000103c7a3c8 swift::performLLVM(swift::IRGenOptions&, swift::DiagnosticEngine*, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, swift::version::Version const&, llvm::StringRef, swift::UnifiedStatsReporter*) + 5816
13 swift 0x0000000103a78c3b 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*) + 12923
14 swift 0x0000000103a6beba swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 48426
15 swift 0x00000001039e3b73 main + 1283
16 libdyld.dylib 0x00007fff70706cc9 start + 1
error: Abort trap: 6 (in target 'InterposeKit' from project 'InterposeKit')
The text was updated successfully, but these errors were encountered: