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-10256] Remove @escaping from parameter flags #52656

Closed
swift-ci opened this issue Apr 1, 2019 · 6 comments
Closed

[SR-10256] Remove @escaping from parameter flags #52656

swift-ci opened this issue Apr 1, 2019 · 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 regression serialization Area → compiler: Serialization & deserialization swift 5.0

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Apr 1, 2019

Previous ID SR-10256
Radar rdar://problem/49522774
Original Reporter jconnolly (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Ubuntu 18.04

Swift version 5.0 (swift-5.0-RELEASE)
Target: x86_64-unknown-linux-gnu

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 5.0Regression, CompilerCrash, Serialization
Assignee @slavapestov
Priority Medium

md5: dd945088d16bb75bd51f68fda682c063

Issue Description:

Trying to build this project https://github.com/John-Connolly/concorde/tree/compiler-crash

on linux causes this error

Note that this compiles fine on mac

swift: /home/buildnode/jenkins/workspace/oss-swift-5.0-package-linux-ubuntu-18_04/swift/lib/Serialization/Serialization.cpp:3740: void swift::serialization::Serializer::writeType(swift::Type): Assertion `elt.getParameterFlags().isNone()' failed.
Stack dump:
0.  Program arguments: /swift/usr/bin/swift -frontend -c -primary-file /home/red/random/concorde/Sources/concorde/Configuration.swift -primary-file /home/red/random/concorde/Sources/concorde/Curry.swift -primary-file /home/red/random/concorde/Sources/concorde/Flip.swift -primary-file /home/red/random/concorde/Sources/concorde/Http/Concorde.swift -primary-file /home/red/random/concorde/Sources/concorde/Http/Conn.swift -primary-file /home/red/random/concorde/Sources/concorde/Http/FileIO.swift -primary-file /home/red/random/concorde/Sources/concorde/Http/HTTPHandler.swift -primary-file /home/red/random/concorde/Sources/concorde/Http/MimeType.swift -primary-file /home/red/random/concorde/Sources/concorde/Http/Request.swift -primary-file /home/red/random/concorde/Sources/concorde/Http/Response.swift -primary-file /home/red/random/concorde/Sources/concorde/Http/ResponseError.swift -primary-file /home/red/random/concorde/Sources/concorde/Http/Routing/Route+Operators.swift -primary-file /home/red/random/concorde/Sources/concorde/Http/Routing/Route.swift -primary-file /home/red/random/concorde/Sources/concorde/Http/Routing/Router.swift -primary-file /home/red/random/concorde/Sources/concorde/Http/ServerState.swift -primary-file /home/red/random/concorde/Sources/concorde/Http/ThreadCache.swift -primary-file /home/red/random/concorde/Sources/concorde/Http/Websockets.swift -primary-file /home/red/random/concorde/Sources/concorde/Monads/Future+Functor.swift -primary-file /home/red/random/concorde/Sources/concorde/Monads/Future+Kleisli.swift -primary-file /home/red/random/concorde/Sources/concorde/Monads/Future+Monad.swift -primary-file /home/red/random/concorde/Sources/concorde/Monads/Future+Zip.swift -primary-file /home/red/random/concorde/Sources/concorde/Monads/Future.swift -primary-file /home/red/random/concorde/Sources/concorde/Monads/IO.swift -primary-file /home/red/random/concorde/Sources/concorde/Monads/Optional+Functor.swift -primary-file /home/red/random/concorde/Sources/concorde/Monads/Optional+Monad.swift -primary-file /home/red/random/concorde/Sources/concorde/Monads/Reader.swift -primary-file /home/red/random/concorde/Sources/concorde/PrecedenceGroups.swift -primary-file /home/red/random/concorde/Sources/concorde/Prelude.swift -primary-file /home/red/random/concorde/Sources/concorde/Streams/BodySink.swift -primary-file /home/red/random/concorde/Sources/concorde/Streams/BodyStream.swift -primary-file /home/red/random/concorde/Sourceed/random/concorde/Sources/concorde/Streams/Consumer.swift -primary-file /home/red/random/concorde/Sources/concorde/Streams/LineStream.swift -primary-file /home/red/random/concorde/Sources/concorde/Streams/Producer.swift -supplementary-output-file-map /tmp/supplementaryOutputs-a4ddb7 -target x86_64-unknown-linux -disable-objc-interop -sdk / -I /home/red/random/concorde/.build/x86_64-unknown-linux/debug -I /home/red/random/concorde/.build/checkouts/swift-nio/Sources/CNIOHTTPParser/include -I /home/red/random/concorde/.build/checkouts/swift-nio/Sources/CNIOSHA1/include -I /home/red/random/concorde/.build/checkouts/swift-nio/Sources/CNIOAtomics/include -I /home/red/random/concorde/.build/checkouts/swift-nio/Sources/CNIODarwin/include -I /home/red/random/concorde/.build/checkouts/swift-nio/Sources/CNIOLinux/include -enable-testing -g -module-cache-path /home/red/random/concorde/.build/x86_64-unknown-linux/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -color-diagnostics -enable-anonymous-context-mangled-names -Xcc -fmodule-map-file=/home/red/random/concorde/.build/x86_64-unknown-linux/debug/CNIOHTTPParser.build/module.modulemap -Xcc -fmodule-map-file=/home/red/random/concorde/.build/x86_64-unknown-linux/debug/CNIOSHA1.build/module.modulemap -Xcc -fmodule-map-file=/home/red/random/concorde/.build/x86_64-unknown-linux/debug/CNIOAtomics.build/module.modulemap -Xcc -fmodule-map-file=/home/red/random/concorde/.build/x86_64-unknown-linux/debug/CNIODarwin.build/module.modulemap -Xcc -fmodule-map-file=/home/red/random/concorde/.build/x86_64-unknown-linux/debug/CNIOLinux.build/module.modulemap -parse-as-library -module-name concorde -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Configuration.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Curry.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Flip.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Http/Concorde.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Http/Conn.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Http/FileIO.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Http/HTTPHandler.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Http/MimeType.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Http/Request.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Http/Response.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Http/ResponseError.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Http/Routing/Route+Operators.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Http/Routing/Route.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Http/Routing/Router.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Http/ServerState.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Http/ThreadCache.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Http/Websockets.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Monads/Future+Functor.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Monads/Future+Kleisli.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Monads/Future+Monad.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Monads/Future+Zip.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Monads/Future.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Monads/IO.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concordetional+Functor.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Monads/Optional+Monad.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Monads/Reader.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/PrecedenceGroups.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Prelude.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Streams/BodySink.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Streams/BodyStream.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Streams/ChunkedStream.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Streams/Consumer.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Streams/LineStream.swift.o -o /home/red/random/concorde/.build/x86_64-unknown-linux/debug/concorde.build/Streams/Producer.swift.o -index-store-path /home/red/random/concorde/.build/x86_64-unknown-linux/debug/index/store -index-system-modules 
/swift/usr/bin/swift[0x42420c4]
/swift/usr/bin/swift[0x423fe4e]
/swift/usr/bin/swift[0x4242282]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7f51f3116890]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7f51f1579e97]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7f51f157b801]
/lib/x86_64-linux-gnu/libc.so.6(+0x3039a)[0x7f51f156b39a]
/lib/x86_64-linux-gnu/libc.so.6(+0x30412)[0x7f51f156b412]
/swift/usr/bin/swift[0x15a2b65]
/swift/usr/bin/swift[0x15a3835]
/swift/usr/bin/swift[0x15a4f26]
/swift/usr/bin/swift[0x15ac1e6]
/swift/usr/bin/swift[0x15ec336]
/swift/usr/bin/swift[0x4c863e]
/swift/usr/bin/swift[0x18d648d]
/swift/usr/bin/swift[0x4c8586]
/swift/usr/bin/swift[0x15ad4ee]
/swift/usr/bin/swift[0x4c8b04]
/swift/usr/bin/swift[0x1311784]
/swift/usr/bin/swift[0x4c1e19]
/swift/usr/bin/swift[0x4bd809]
/swift/usr/bin/swift[0x46e670]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f51f155cb97]
/swift/usr/bin/swift[0x46ca8a]
@belkadan
Copy link
Contributor

belkadan commented Apr 1, 2019

Thanks, John. Looks a bit like another Linux Serialization bug I haven't gotten the chance to look at yet. :-(

@swift-ci
Copy link
Collaborator Author

swift-ci commented Apr 1, 2019

Comment by John Connolly (JIRA)

Okay! Any tips on how to isolate what piece of code might be cause this?

@belkadan
Copy link
Contributor

belkadan commented Apr 1, 2019

Hm, well, the error is about parameter flags in a tuple type. Are you trying to use enum cases with autoclosures or variadics or anything like that?

Grabbing a trunk development snapshot might also help narrow it down; there's some additional crash logging that's been added since the 5.0 branch.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Apr 3, 2019

Comment by John Connolly (JIRA)

@belkadan I managed to isolate the bug and get a much smaller repro 🙂

This crashes the compiler.

precedencegroup LeftPrecedence {
    associativity: left
    lowerThan: LogicalDisjunctionPrecedence
    higherThan: AssignmentPrecedence
}


infix operator >>>: LeftPrecedence


public func >>> <A,B,C>(f: @escaping (A) -> B, g: @escaping (B) -> C) -> (A) -> C {
    return { a in
        return g(f(a))
    }
}



public let fandg = f >>> g

private func f(h: @escaping () -> (), other: String) -> String {
    return ""
}


private func g(_ str: String) {


}

@slavapestov
Copy link
Member

The problem is the type of `fandg`:

@_hasStorage @_hasInitialValue public let fandg: ((@escaping () -> (), String)) -> () { get }

This is not really a serialization bug. In fact 'escaping' should not be part of the parameter flags at all. I was going to remove that at some point so I'm going to steal the bug.

@slavapestov
Copy link
Member

#24079

@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 regression serialization Area → compiler: Serialization & deserialization swift 5.0
Projects
None yet
Development

No branches or pull requests

4 participants