swiftlang / swift

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

[SR-2668] Assertion failed during compilation #45273

Open swift-ci opened 8 years ago

swift-ci commented 8 years ago
Previous ID SR-2668
Radar None
Original Reporter badthing (JIRA User)
Type Bug
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 1 | |Component/s | Compiler | |Labels | Bug, CompilerCrash | |Assignee | @slavapestov | |Priority | Medium | md5: f215e5a8dd950f1a6562ac03196ee57d

relates to:

Issue Description:

In all DEVELOPMENT-SNAPSHOT toolchains released after 09-07 I am seeing a consistently reproducible crash during compilation.

https://github.com/PerfectlySoft/Perfect-HTTPServer.git

The above repository, when built with SPM, will generate the following crash (note that this report is made with 09-11 since the chains after that do not seem to spit out the full back trace). The crash is always consistent. The latest toolchain I tested with is 09-15. I have not tried this on Linux.

swift build Compile Swift Module 'PerfectThread' (2 sources) Compile Swift Module 'PerfectLib' (10 sources) Compile Swift Module 'PerfectNet' (5 sources) Compile Swift Module 'PerfectHTTP' (9 sources) Compile Swift Module 'PerfectHTTPServer' (5 sources) Assertion failed: (!outerOrigType.isTuple()), function planTupleIntoDirectResult, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/SILGen/SILGenPoly.cpp, line 1831. 0 swift 0x000000010e7ffa7b llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43 1 swift 0x000000010e7fecc6 llvm::sys::RunSignalHandlers() + 70 2 swift 0x000000010e8001cf SignalHandler(int) + 383 3 libsystem_platform.dylib 0x00007fffa8e36bba _sigtramp + 26 4 swift 0x000000010f30b631 cmark_strbufinitbuf + 73296 5 swift 0x000000010e7fff1e abort + 14 6 swift 0x000000010e7fff01 assert_rtn + 81 7 swift 0x000000010bc73d58 (anonymous namespace)::ResultPlanner::planTupleIntoDirectResult(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper, swift::Lowering::AbstractionPattern, swift::CanType, (anonymous namespace)::ResultPlanner::PlanData&, swift::SILResultInfo) + 2152 8 swift 0x000000010bc73ba5 (anonymous namespace)::ResultPlanner::planTupleIntoDirectResult(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper, swift::Lowering::AbstractionPattern, swift::CanType, (anonymous namespace)::ResultPlanner::PlanData&, swift::SILResultInfo) + 1717 9 swift 0x000000010bc72734 (anonymous namespace)::ResultPlanner::plan(swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, (anonymous namespace)::ResultPlanner::PlanData&) + 948 10 swift 0x000000010bc6dba6 (anonymous namespace)::ResultPlanner::plan(swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, swift::CanTypeWrapper, swift::CanTypeWrapper, llvm::SmallVectorImpl&) + 326 11 swift 0x000000010bc7005c createThunk(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper, swift::Lowering::TypeLowering const&) + 1772 12 swift 0x000000010bc698bb (anonymous namespace)::Transform::transform(swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::SGFContext) + 1915 13 swift 0x000000010bc690f0 swift::Lowering::SILGenFunction::emitTransformedValue(swift::SILLocation, swift::Lowering::ManagedValue, swift::CanType, swift::CanType, swift::Lowering::SGFContext) + 352 14 swift 0x000000010bc339b1 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 29073 15 swift 0x000000010bc27923 swift::Lowering::SILGenFunction::emitRValue(swift::Expr*, swift::Lowering::SGFContext) + 35 16 swift 0x000000010bbff1f1 (anonymous namespace)::ArgEmitter::emitArgumentFromSource(swift::Lowering::ArgumentSource&&, swift::SILType, swift::Lowering::AbstractionPattern, swift::SILParameterInfo) + 289 17 swift 0x000000010bbfacbd (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 989 18 swift 0x000000010bbfc16a (anonymous namespace)::ArgEmitter::emitExpanded(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 234 19 swift 0x000000010bbfa9f7 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 279 20 swift 0x000000010bbf9fd4 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl&, llvm::SmallVectorImpl<std::__1::pair<swift::Lowering::LValue, swift::SILLocation> >&, llvm::Optional const&, swift::ImportAsMemberStatus const&) && + 500 21 swift 0x000000010bbe629b (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 4603 22 swift 0x000000010bbe4ba3 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 51 23 swift 0x000000010bc2c875 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 85 24 swift 0x000000010bc2afad swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 61 25 swift 0x000000010bc32552 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 23858 26 swift 0x000000010bc2b276 swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 470 27 swift 0x000000010bc7de3d swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 653 28 swift 0x000000010bc7dba5 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21 29 swift 0x000000010bc4015a swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 362 30 swift 0x000000010bbdf648 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*)::$_1::operator()(swift::SILFunction*) const + 216 31 swift 0x000000010bbd5d85 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 629 32 swift 0x000000010bc83276 (anonymous namespace)::SILGenType::emitType() + 966 33 swift 0x000000010bc82e2e swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 30 34 swift 0x000000010bbdbf8b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 715 35 swift 0x000000010bbdce85 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional, bool, bool) + 949 36 swift 0x000000010bbdd3a5 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional, bool) + 117 37 swift 0x000000010ba47db6 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 8406 38 swift 0x000000010ba05230 main + 2544 39 libdyld.dylib 0x00007fffa8c2a255 start + 1 40 libdyld.dylib 0x000000000000002c start + 1463639512 Stack dump:

  1. Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-09-11-a.xctoolchain/usr/bin/swift -frontend -c /Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/Sources/PerfectHTTPServer/HPACK.swift -primary-file /Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP11Request.swift /Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP11Response.swift /Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP2.swift /Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTPServer.swift -target x86_64-apple-macosx10.10 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I /Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/.build/debug -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -enable-testing -g -module-cache-path /Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/.build/debug/ModuleCache -D SWIFT_PACKAGE -Xcc -fmodule-map-file=/Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/Packages/COpenSSL-2.0.1/COpenSSL/include/module.modulemap -Xcc -fmodule-map-file=/Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/.build/debug/CHTTPParser.build/module.modulemap -emit-module-doc-path /Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/.build/debug/PerfectHTTPServer.build/HTTP11Request~partial.swiftdoc -Onone -parse-as-library -module-name PerfectHTTPServer -emit-module-path /Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/.build/debug/PerfectHTTPServer.build/HTTP11Request~partial.swiftmodule -emit-dependencies-path /Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/.build/debug/PerfectHTTPServer.build/HTTP11Request.d -emit-reference-dependencies-path /Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/.build/debug/PerfectHTTPServer.build/HTTP11Request.swiftdeps -num-threads 8 -o /Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/.build/debug/PerfectHTTPServer.build/HTTP11Request.swift.o
  2. While emitting SIL for 'parserBody' at /Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP11Request.swift:224:2
  3. While emitting reabstraction thunk in SIL function @_TTRXFo_dGSpVs5UInt8_XFodGSpSdGSqTzoPs5Error:0: error: unable to execute command: Illegal instruction: 4 :0: error: compile command failed due to signal (use -v to see invocation) :0: error: build had 1 command failures error: exit(1): /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-09-11-a.xctoolchain/usr/bin/swift-build-tool -f /Users/kjessup/development/PerfectNeu/Perfect-HTTPServer/.build/debug.yaml
swift-ci commented 7 years ago

Comment by Aidan Steele (JIRA)

For what it's worth, this bug is also consistently hit on Linux (Ubuntu 16.04) with swift-DEVELOPMENT-SNAPSHOT-2016-12-07-a