Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-8119] Compiler crashes on building Vapor with swift-DEVELOPMENT-SNAPSHOT-2018-06-16-a or later #50651

Closed
norio-nomura opened this issue Jun 27, 2018 · 6 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@norio-nomura
Copy link
Contributor

Previous ID SR-8119
Radar rdar://problem/41498944
Original Reporter @norio-nomura
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

ubuntu 16.04
swift-DEVELOPMENT-SNAPSHOT-2018-06-16-a

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee @DougGregor
Priority Medium

md5: 8ae8e930a178ec1fc290397bb039a45c

Issue Description:

Reproducing steps:

  1. docker run -it --rm norionomura/swift:20180616a

  2. git clone https://github.com/vapor/vapor.git

  3. cd vapor

  4. swift build

Compile Swift Module 'DatabaseKit' (30 sources)
TYPE MISMATCH IN ARGUMENT 0 OF APPLY AT expression at [/vapor/.build/checkouts/database-kit.git--596542490310838932/Sources/DatabaseKit/Connection/Container+CachedConnection.swift:36:21 - line:36:48] RangeText="pool.releaseConnection(conn)"
  argument value:   %3 = project_box %1 : $<τ_0_0 where τ_0_0 : Container><τ_1_0 where τ_1_0 : Database> { var τ_1_0.Connection } <Self, Database>, 0 // user: %4
  parameter type: $Database.Connection
#&#8203;0 0x00000000040e1454 PrintStackTraceSignalHandler(void*) (/usr/bin/swift+0x40e1454)
#&#8203;1 0x00000000040df2e2 llvm::sys::RunSignalHandlers() (/usr/bin/swift+0x40df2e2)
#&#8203;2 0x00000000040e1602 SignalHandler(int) (/usr/bin/swift+0x40e1602)
#&#8203;3 0x00007faac21d3390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#&#8203;4 0x00007faac0912428 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35428)
#&#8203;5 0x00007faac091402a abort (/lib/x86_64-linux-gnu/libc.so.6+0x3702a)
#&#8203;6 0x0000000000d0d597 swift::Lowering::SILGenFunction::emitApply(std::unique_ptr<swift::Lowering::ResultPlan, std::default_delete<swift::Lowering::ResultPlan> >&&, swift::Lowering::ArgumentScope&&, swift::SILLocation, swift::Lowering::ManagedValue, swift::SubstitutionMap, llvm::ArrayRef<swift::Lowering::ManagedValue>, swift::Lowering::CalleeTypeInfo const&, swift::Lowering::ApplyOptions, swift::Lowering::SGFContext) (/usr/bin/swift+0xd0d597)
#&#8203;7 0x0000000000d0ff29 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) (/usr/bin/swift+0xd0ff29)
#&#8203;8 0x0000000000d0f015 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) (/usr/bin/swift+0xd0f015)
#&#8203;9 0x0000000000ca69a8 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) (/usr/bin/swift+0xca69a8)
#&#8203;10 0x0000000000c96574 swift::Lowering::SILGenFunction::emitRValue(swift::Expr*, swift::Lowering::SGFContext) (/usr/bin/swift+0xc96574)
#&#8203;11 0x0000000000cf38d0 swift::Lowering::SILGenFunction::emitReturnExpr(swift::SILLocation, swift::Expr*) (/usr/bin/swift+0xcf38d0)
#&#8203;12 0x0000000000cf235f swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) (/usr/bin/swift+0xcf235f)
#&#8203;13 0x0000000000cf0309 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) (/usr/bin/swift+0xcf0309)
#&#8203;14 0x0000000000cf01ce swift::Lowering::SILGenFunction::emitS<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
error: terminated(1): /usr/bin/swift-build-tool -f /vapor/.build/debug.yaml main output:
@norio-nomura
Copy link
Contributor Author

It still fails with swift-DEVELOPMENT-SNAPSHOT-2018-06-26-a.

@belkadan
Copy link
Contributor

@swift-ci create

@DougGregor
Copy link
Member

I introduced this regression recently. Here's a reduction of the issue:

protocol DatabaseProtocol {
  associatedtype Connection: DatabaseConnection
}

protocol DatabaseConnection {
  associatedtype Database: DatabaseProtocol
    where Database.Connection == Self
}

We're hitting a cycle in type checking:

$ swiftc -frontend -typecheck t.swift -debug-cycles
===CYCLE DETECTED===
`--InheritedTypeRequest(t.(file).DatabaseProtocol.Connection@t.swift:2:18, 0)
`--InheritedTypeRequest(t.(file).DatabaseConnection.Database@t.swift:6:18, 0)
`--InheritedTypeRequest(t.(file).DatabaseProtocol.Connection@t.swift:2:18, 0) (cyclic dependency)

@DougGregor
Copy link
Member

A ton of refactoring later, and the pull request at #18923 gets this building again.

@norio-nomura
Copy link
Contributor Author

Sorry, I have deleted norionomura/swift:20180616a from Docker Hub. 😛
As a result of confirming again, in this reproducing steps, the crash occurred until swift-DEVELOPMENT-SNAPSHOT-2018-07-02-a and did not with swift-DEVELOPMENT-SNAPSHOT-2018-07-03-a.
However, the XFAIL step in CircleCI to detect that this issue has been fixed did not fail until today. https://circleci.com/gh/norio-nomura/SwiftCompilerDiscordappBot/tree/swift
It seems that the PR has not yet been merged, but my issue seems to have already been fixed by a ton of refactoring.
Thanks! 🙂

@DougGregor
Copy link
Member

Merged.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

4 participants