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

It crashes, when passing any Sequence to Array.init(_ s: Sequence) #64303

Open
carlhung opened this issue Mar 11, 2023 · 2 comments
Open

It crashes, when passing any Sequence to Array.init(_ s: Sequence) #64303

carlhung opened this issue Mar 11, 2023 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software existentials Feature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased values generics Feature: generic declarations and types implicit existential opening Feature → existentials: implicit opening of existentials when passed to parameters of generic type swift 5.9 type checker Area → compiler: Semantic analysis

Comments

@carlhung
Copy link

carlhung commented Mar 11, 2023

Description
It crashes when passing any Sequence to Array.init(_ s: Sequence)
VSCode showed The SourceKit-LSP server crashed 6 times in the last 3 minutes. See the output for more information. Do you want to restart it again.

when typing command swift build, it showed the error below:

carlhung@XPS9570:~/swiftProjects/swiftPlayground$ swift build
Building for debugging...
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0.      Program arguments: /home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend -frontend -emit-module -experimental-skip-non-inlinable-function-bodies-without-types /home/carlhung/swiftProjects/swiftPlayground/Sources/playground/main.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -I /home/carlhung/swiftProjects/swiftPlayground/.build/x86_64-unknown-linux-gnu/debug -color-diagnostics -enable-testing -g -module-cache-path /home/carlhung/swiftProjects/swiftPlayground/.build/x86_64-unknown-linux-gnu/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -new-driver-path /home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-driver -empty-abi-descriptor -resource-dir /home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/lib/swift -enable-anonymous-context-mangled-names -module-name playground -emit-module-doc-path /home/carlhung/swiftProjects/swiftPlayground/.build/x86_64-unknown-linux-gnu/debug/playground.build/playground.swiftdoc -emit-module-source-info-path /home/carlhung/swiftProjects/swiftPlayground/.build/x86_64-unknown-linux-gnu/debug/playground.build/playground.swiftsourceinfo -emit-dependencies-path /home/carlhung/swiftProjects/swiftPlayground/.build/x86_64-unknown-linux-gnu/debug/playground.build/playground.emit-module.d -o /home/carlhung/swiftProjects/swiftPlayground/.build/x86_64-unknown-linux-gnu/debug/playground.build/playground.swiftmodule
1.      Swift version 5.7 (swift-5.7-RELEASE)
2.      Compiling with the current language version
3.      While evaluating request TypeCheckSourceFileRequest(source_file "/home/carlhung/swiftProjects/swiftPlayground/Sources/playground/main.swift")
4.      While type-checking statement at [/home/carlhung/swiftProjects/swiftPlayground/Sources/playground/main.swift:36:1 - line:36:16] RangeText="let a = Array(s"
5.      While type-checking declaration 0x95eb850 (at /home/carlhung/swiftProjects/swiftPlayground/Sources/playground/main.swift:36:1)
6.      While evaluating request PatternBindingEntryRequest((unknown decl), 0, 0)
7.      While type-checking expression at [/home/carlhung/swiftProjects/swiftPlayground/Sources/playground/main.swift:36:9 - line:36:16] RangeText="Array(s"
8.      While type-checking-target starting at /home/carlhung/swiftProjects/swiftPlayground/Sources/playground/main.swift:36:9
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x52ca843]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x52c874e]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x52cabcf]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x14420)[0x7fdb7634f420]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x12bf529]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x12e116c]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x12e02f2]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x12bc17a]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x12bbdc8]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x12bab44]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x12b980a]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x11c08f2]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x11c0674]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x11c1da8]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x11c1f9c]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x1276877]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x11dfc42]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x11dfacf]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x11f5ff9]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x11f2724]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x11f265f]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x1270bfa]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x127285c]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x1271e2c]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x1271ea1]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x129fa9a]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x12a1694]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x12a151b]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x129f969]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x5da199]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x5cfd97]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x5cfc38]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x5822a3]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x45172f]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7fdb75779083]
/home/carlhung/swift-5.7-RELEASE-ubuntu20.04/usr/bin/swift-frontend[0x45074e]

Steps to reproduce

let s: any Sequence = [35,34,6,34,3] as Set
let a = Array.init(s)

Expected behavior
No crash.

Environment
vscode
20.04.5 LTS
swift 5.7

@carlhung carlhung added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Mar 11, 2023
@tbkka
Copy link
Contributor

tbkka commented Mar 11, 2023

CC: @hborla @xedin

@xedin
Copy link
Contributor

xedin commented Mar 12, 2023

on main it's crashing in CSApply::coerceToType due to existential opening.

@xedin xedin added type checker Area → compiler: Semantic analysis compiler crash generics Feature: generic declarations and types and removed triage needed This issue needs more specific labels labels Mar 12, 2023
@AnthonyLatsis AnthonyLatsis added swift 5.7 crash Bug: A crash, i.e., an abnormal termination of software existentials Feature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased values implicit existential opening Feature → existentials: implicit opening of existentials when passed to parameters of generic type compiler The Swift compiler itself swift 5.9 and removed swift 5.7 labels Mar 13, 2023
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 itself crash Bug: A crash, i.e., an abnormal termination of software existentials Feature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased values generics Feature: generic declarations and types implicit existential opening Feature → existentials: implicit opening of existentials when passed to parameters of generic type swift 5.9 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants