swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.3k stars 10.34k forks source link

[SR-4540] Compiler crash in SILGen for delegating initializer #47117

Closed swift-ci closed 2 years ago

swift-ci commented 7 years ago
Previous ID SR-4540
Radar rdar://problem/34582924
Original Reporter mlwoollard (JIRA User)
Type Bug
Status Closed
Resolution Done

Attachment: Download

Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug, 4.0Regression, CompilerCrash | |Assignee | mlwoollard (JIRA) | |Priority | Medium | md5: c7cad74eba187683e2a9b7712a315d7f

Issue Description:

Attempting to build our codebase with the 1st April master snapshot results in compiler crash. This code compiles and runs fine with toolchain included in Xcode 8.3.1. Not able to quickly provide a concise sample to reproduce but happy to work with team to provide any further info !

Console output:

unexpected storage type that differs from type-of-rvalue
UNREACHABLE executed at /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/SILGen/SILGenLValue.cpp:2313!
0  swift                    0x000000010cceb178 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010ccea146 llvm::sys::RunSignalHandlers() + 86
2  swift                    0x000000010cceb739 SignalHandler(int) + 361
3  libsystem_platform.dylib 0x00007fff912a1b3a _sigtramp + 26
4  libsystem_platform.dylib 0x00007fff5606f460 _sigtramp + 3302807872
5  libsystem_c.dylib        0x00007fff91126420 abort + 129
6  swift                    0x000000010cc8aa17 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 471
7  swift                    0x000000010a2dcdc0 swift::Lowering::SILGenFunction::emitSemanticStore(swift::SILLocation, swift::SILValue, swift::SILValue, swift::Lowering::TypeLowering const&, swift::IsInitialization_t) + 1712
8  swift                    0x000000010a2c972e (anonymous namespace)::DelegateInitSelfWritebackCleanup::emit(swift::Lowering::SILGenFunction&, swift::CleanupLocation) + 126
9  swift                    0x000000010a24bf14 swift::Lowering::CleanupManager::emitCleanups(swift::DiverseStackBase::stable_iterator, swift::CleanupLocation, bool) + 308
10 swift                    0x000000010a24c24b swift::Lowering::CleanupManager::emitBranchAndCleanups(swift::Lowering::JumpDest, swift::SILLocation, llvm::ArrayRef<swift::SILValue>) + 91
11 swift                    0x000000010a315390 swift::Lowering::SILGenFunction::getTryApplyErrorDest(swift::SILLocation, swift::SILResultInfo, bool) + 688
12 swift                    0x000000010a2668ea swift::Lowering::SILGenFunction::emitApply(std::__1::unique_ptr<swift::Lowering::ResultPlan, std::__1::default_delete<swift::Lowering::ResultPlan> >&&, swift::Lowering::ArgumentScope&&, swift::SILLocation, swift::Lowering::ManagedValue, llvm::ArrayRef<swift::Substitution>, llvm::ArrayRef<swift::Lowering::ManagedValue>, swift::Lowering::CalleeTypeInfo const&, swift::Lowering::ApplyOptions, swift::Lowering::SGFContext) + 2154
13 swift                    0x000000010a269b17 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3559
14 swift                    0x000000010a2687e3 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 51
15 swift                    0x000000010a2bac55 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 85
16 swift                    0x000000010a2bb84b swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 3147
17 swift                    0x000000010a2b9359 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 57
18 swift                    0x000000010a24aefb swift::Lowering::ArgumentSource::getAsSingleValue(swift::Lowering::SILGenFunction&, swift::Lowering::SGFContext) && + 475
19 swift                    0x000000010a27d8f5 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 3285
20 swift                    0x000000010a27ec9a (anonymous namespace)::ArgEmitter::emitExpanded(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 234
21 swift                    0x000000010a27cd50 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 304
22 swift                    0x000000010a27c3a4 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<std::__1::pair<swift::Lowering::LValue, swift::SILLocation> >&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus const&) && + 452
23 swift                    0x000000010a27bb88 (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>&, llvm::Optional<swift::ForeignErrorConvention>&, swift::ImportAsMemberStatus&, swift::Lowering::ApplyOptions&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 2232
24 swift                    0x000000010a269a3f (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3343
25 swift                    0x000000010a2687e3 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 51
26 swift                    0x000000010a2bac55 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 85
27 swift                    0x000000010a2b9359 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 57
28 swift                    0x000000010a2c4a68 (anonymous namespace)::RValueEmitter::visitRebindSelfInConstructorExpr(swift::RebindSelfInConstructorExpr*, swift::Lowering::SGFContext) + 392
29 swift                    0x000000010a2bcbec swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 8172
30 swift                    0x000000010a2b9623 swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 467
31 swift                    0x000000010a3117dd swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 653
32 swift                    0x000000010a311545 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
33 swift                    0x000000010a29baf2 swift::Lowering::SILGenFunction::emitClassConstructorInitializer(swift::ConstructorDecl*) + 2594
34 swift                    0x000000010a263f2e swift::Lowering::SILGenModule::emitConstructor(swift::ConstructorDecl*)::$_3::operator()(swift::SILFunction*) const + 206
35 swift                    0x000000010a25cc7f swift::Lowering::SILGenModule::emitConstructor(swift::ConstructorDecl*) + 2095
36 swift                    0x000000010a31ad67 (anonymous namespace)::SILGenType::emitType() + 663
37 swift                    0x000000010a31aac9 swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 25
38 swift                    0x000000010a2601fb swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 843
39 swift                    0x000000010a2611b9 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 953
40 swift                    0x000000010a261714 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 116
41 swift                    0x0000000109bd130e swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 12574
42 swift                    0x0000000109b8be10 main + 3312
43 libdyld.dylib            0x00007fff91092235 start + 1
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2017-04-01-a.xctoolchain/usr/bin/swift -frontend -c /Users/markw/UrbanThings/zt/utrx_apple/Sources/RootWiring.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/iOS/Router.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/TrackActivity.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/iOS/RxMailComposeDelegateProxy.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/Cache.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/WiringType.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/iOS/Cell.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/PresentWiring.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/iOS/AnyViewControllerRef.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/iOS/UIActivityIndicatorView+Rx.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/iOS/UIRefreshControl.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/iOS/View.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/ShowDetailWiring.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/PushWiring.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/Rx+Extensions.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/UIViewController.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/TrackActivity+UIKit.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/UserPromptService.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/iOS/CollectionView.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/UIAlertController.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/iOS/MFMailComposeViewController+Rx.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/MemoryCache.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/ShowWiring.swift -primary-file /Users/markw/UrbanThings/zt/utrx_apple/Sources/FileCache.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/PopoverWiring.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/iOS/UIView+Rx.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/Network+Rx.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/LocationItemType.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/StoreCache.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/UserPromptServiceImpl.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/AnyWiring.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/UITableView.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/iOS/Reachability+Rx.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/iOS/UIButton+Rx.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/UIViewController+Rx.swift /Users/markw/UrbanThings/zt/utrx_apple/Sources/iOS/BusyOverlay.swift -target x86_64-apple-ios8.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -I /Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Products/Debug-iphonesimulator -F /Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Products/Debug-iphonesimulator -application-extension -enable-testing -g -import-underlying-module -module-cache-path /Users/markw/Library/Developer/Xcode/DerivedData/ModuleCache -D TARGET_INTERFACE_BUILDER -serialize-debugging-options -Xcc -I/Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Intermediates/UTRx.build/Debug-iphonesimulator/UTRx-iOS.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Intermediates/UTRx.build/Debug-iphonesimulator/UTRx-iOS.build/UTRx-generated-files.hmap -Xcc -I/Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Intermediates/UTRx.build/Debug-iphonesimulator/UTRx-iOS.build/UTRx-own-target-headers.hmap -Xcc -I/Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Intermediates/UTRx.build/Debug-iphonesimulator/UTRx-iOS.build/UTRx-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Intermediates/UTRx.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Intermediates/UTRx.build/Debug-iphonesimulator/UTRx-iOS.build/UTRx-project-headers.hmap -Xcc -I/Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Products/Debug-iphonesimulator/include -Xcc -I/Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Intermediates/UTRx.build/Debug-iphonesimulator/UTRx-iOS.build/DerivedSources/x86_64 -Xcc -I/Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Intermediates/UTRx.build/Debug-iphonesimulator/UTRx-iOS.build/DerivedSources -Xcc -DTARGET_INTERFACE_BUILDER=1 -Xcc -DDEBUG=1 -Xcc -ivfsoverlay -Xcc /Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Intermediates/UTRx.build/Debug-iphonesimulator/UTRx-iOS.build/unextended-module-overlay.yaml -Xcc -working-directory/Users/markw/UrbanThings/zt/utrx_apple -emit-module-doc-path /Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Intermediates/UTRx.build/Debug-iphonesimulator/UTRx-iOS.build/Objects-normal/x86_64/FileCache~partial.swiftdoc -serialize-diagnostics-path /Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Intermediates/UTRx.build/Debug-iphonesimulator/UTRx-iOS.build/Objects-normal/x86_64/FileCache.dia -Onone -module-name UTRx -emit-module-path /Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Intermediates/UTRx.build/Debug-iphonesimulator/UTRx-iOS.build/Objects-normal/x86_64/FileCache~partial.swiftmodule -emit-dependencies-path /Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Intermediates/UTRx.build/Debug-iphonesimulator/UTRx-iOS.build/Objects-normal/x86_64/FileCache.d -emit-reference-dependencies-path /Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Intermediates/UTRx.build/Debug-iphonesimulator/UTRx-iOS.build/Objects-normal/x86_64/FileCache.swiftdeps -o /Users/markw/Library/Developer/Xcode/DerivedData/ZipTrip-fnpqeenuvfvjnbcckyfzwkgbdlxn/Build/Intermediates/IBDesignables/Intermediates/UTRx.build/Debug-iphonesimulator/UTRx-iOS.build/Objects-normal/x86_64/FileCache.o 
1.  While silgen constructor initializer SIL function "@_T04UTRx9FileCacheCACyxq_q0_GSS10identifier_Sd10expiryTimeSd13maximumWeight7RxSwift17PrimitiveSequenceVyAH11SingleTraitOq_Gx_SdSbtcSg12upstreamFunctKcfc".
 for 'init' at /Users/markw/UrbanThings/zt/utrx_apple/Sources/FileCache.swift:182:12
belkadan commented 7 years ago

Any chance you can attach your entire project, then? Or if not here in public, would you be willing to file a bug with us at Apple (https://bugreport.apple.com) and attach it there?

@gottesmm, does this happen to look familiar?

gottesmm commented 7 years ago

It may be mine. We really need a reproducer.

swift-ci commented 7 years ago

Comment by Mark Woollard (JIRA)

I'll try and get something to you that reproduces this - hopefully can get down to a relatively small project since the source file that is causing the crash doesn't have too many dependencies. May be a day or two until I can get to it.

swift-ci commented 7 years ago

Comment by Mark Woollard (JIRA)

OK was a lot easier that thought - simple project attached to reproduce crash - note that code dependent on RxSwift 3.3.1 or later (zip includes 3.4) configured via CocoaPods so you'll have to use the workspace file to build.

gottesmm commented 7 years ago

I was able to build with the workspace with the latest released Xcode without issue (as expected, just saying that the workspace build works). I am going to try with a ToT build now.

slavapestov commented 6 years ago

@swift-ci create

gottesmm commented 6 years ago

mlwoollard (JIRA User) I think I forgot to update this bug report that I fixed this bug. Can you try with the latest Xcode and see if it occurs for you just to verify?

swift-ci commented 3 years ago

Comment by Mark Woollard (JIRA)

Just signed in after a long absence - can confirm this is fixed ![]( Sorry for the delay )

swift-ci commented 2 years ago

Comment by Mark Woollard (JIRA)

Have confirmed issue is resolved