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

Compiler crash in Swift 5.7 #59738

Open
Frizlab opened this issue Jun 27, 2022 · 5 comments
Open

Compiler crash in Swift 5.7 #59738

Frizlab opened this issue Jun 27, 2022 · 5 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. SILGen Area → compiler: The SIL generation stage

Comments

@Frizlab
Copy link

Frizlab commented Jun 27, 2022

Describe the bug
Trying to compile this repo at this tag crashes the compiler w/ the current preview of Swift 5.7 (see versions later).

When switching to tag __SWIFT_5.7_CRASHER_WORKAROUND__ there are no crashes of the compiler anymore.

To Reproduce
Steps to reproduce the behavior:

  1. Clone the repo https://github.com/happn-app/officectl.git and checkout the tag __SWIFT_5.7_CRASHER__
  2. Try and compile w/ Swift 5.7 (either on macOS or Linux)

Expected behavior
The compilation should report errors or should pass. It should not crash.

Environment

  • OS: macOS 12.4 and Linux (Docker)
  • Xcode Version: 14.0 beta 2 (14A5229c)
  • Docker image: swiftlang/swift:nightly-5.7-focal (5ea3ea9c2666)

Additional context
I think there are two bugs. There are two commits between __SWIFT_5.7_CRASHER__ and __SWIFT_5.7_CRASHER_WORKAROUND__. One fixes the first issue, the other fixes the other issue.
I don’t know what the issues are though.

I tried reducing the crash but did not succeed.

@Frizlab Frizlab added the bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. label Jun 27, 2022
@slavapestov slavapestov self-assigned this Aug 15, 2022
@slavapestov
Copy link
Contributor

I cannot reproduce the issue with a recent 14.0 beta. It may have been fixed. Do you have a crash log?

@Frizlab
Copy link
Author

Frizlab commented Aug 16, 2022

When compiling with Xcode 14.0 beta 5 (14A5294e), I get this: https://gist.github.com/Frizlab/ce48383e4ef379b7f840eacd883ed632

The gist contains the output when compiling with Xcode directly, and when compiling using the command line with the same Xcode version toolchain (swift build, with Swift version swift-driver version: 1.62.3 Apple Swift version 5.7 (swiftlang-5.7.0.123.8 clang-1400.0.29.50) Target: arm64-apple-macosx12.0).

The crash is reproducible 100% on my side.

I can get the same crash in Xcode than in SPM by workarounding the Xcode crash. See this commit.
The SPM crash is workarounded with this commit.

Neither workarounds are equivalent to the original code; they are simply a removal of the code that make the compiler crash.

@slavapestov
Copy link
Contributor

Ah, looks like a SILGen bug.

@slavapestov slavapestov added the SILGen Area → compiler: The SIL generation stage label Aug 16, 2022
@Frizlab
Copy link
Author

Frizlab commented Aug 27, 2022

Still occurring with Xcode 14.0 beta 6 (14A5294g).

@Frizlab
Copy link
Author

Frizlab commented Aug 31, 2022

Seems fixed (I did not get the crash) with toolchain org.swift.57202208291a (Apple Swift version 5.8-dev (LLVM 03bd949eeee4761, Swift 2c40a850df6f409) - Target: arm64-apple-macosx13.0).

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. SILGen Area → compiler: The SIL generation stage
Projects
None yet
Development

No branches or pull requests

2 participants