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-8429] Segmentation fault with Xcode beta 5 when using ternary operator with code coverage #50953

Closed
swift-ci opened this issue Jul 31, 2018 · 7 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code coverage Area → source tooling: code coverage compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-8429
Radar None
Original Reporter leohemanth (JIRA User)
Type Bug

Attachment: Download

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

md5: c68546b1b506c183c6a7e89f2b882338

Issue Description:

The following 2 lines cause the compiler crash when used with code coverage. (It works fine with code coverage turned off) on Xcode beta 5

let falseBool: Bool = false
lazy var offset: CGFloat = falseBool ? 30 : 55 

I've attached sample project to show case the problem

@swift-ci
Copy link
Collaborator Author

Comment by Hemanth Prasad (JIRA)

@vedantk

@swift-ci
Copy link
Collaborator Author

Comment by Hemanth Prasad (JIRA)

@vedantk this issue occurs even on the latest Xcode beta (Xcode 10 beta 6). Do you think it could be fixed before the GM release of Xcode 10?

@vedantk
Copy link
Member

vedantk commented Aug 17, 2018

Thanks for the report. I take this issue seriously, but can't speculate about a future Xcode release.

@swift-ci
Copy link
Collaborator Author

Comment by Hemanth Prasad (JIRA)

@vedantk thanks for looking into it. Would be able to suggest a work around? We have a huge code base, I was hoping we don't have remove all the ternary operators in the codebase.

@vedantk
Copy link
Member

vedantk commented Sep 12, 2018

The underlying issue is unrelated to the ternary operator. You can work around this particular crash by either not using the lazy keyword on the property, or by writing its initializer in an explicit lambda.

@swift-ci
Copy link
Collaborator Author

Comment by Hemanth Prasad (JIRA)

Thanks @vedantk both of the work around worked.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@hamishknight
Copy link
Collaborator

This no longer crashes in Xcode 14, and on main we generate coverage for the lazy property initializer (#60643)

@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
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. code coverage Area → source tooling: code coverage 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