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-9049] Swift syntax with undesirable behavior make Xcode sometime crash. #4621

Open
swift-ci opened this issue Oct 20, 2018 · 7 comments
Open
Labels
bug Something isn't working LLDB for Swift

Comments

@swift-ci
Copy link

Previous ID SR-9049
Radar rdar://problem/45511833
Original Reporter nhatlee89 (JIRA User)
Type Bug

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Bug
Assignee None
Priority Medium

md5: ec567cfc707ab584a6c6fb9ee5e752c0

Issue Description:

As discussion on [forums|https://forums.swift.org/t/swift-4-2-strange-behavior/17177/6.] I use Playground with Xcode 10 on MacOS 10.14. The below code make Xcode sometime crash:

let (x: Int, y: Double) = (3, 1.0)
let result = Int + Double
print(result)

And sometime fail with suggestion report the crash like the image:

![](Screen Shot 2018-10-20 at 1.06.19 PM.png)

I attached the crash logs which have prefix `lldb-rpc-serve`:
lldb-rpc-server_2018-09-26-103226_Nhats-MacBook-Pro.crash

After I change the code to:

let (x: Int, y: Double) = (3, 1)
let result = Int + Double
print(result)//4

The result is 4. But I expected it fail to compile.

@belkadan
Copy link

This line

let (x: Int, y: Double) = (3, 1)

doesn't do what you think: it's saying "convert (3, 1) to (x: 3, y: 1), then unpack that into two variables named 'Int' and 'Double'". We have other bugs about warning when that happens, but whether or not it's desired behavior it shouldn't result in a crash.

@swift-ci create

@swift-ci
Copy link
Author

Comment by Fred Riss (JIRA)

About the crash: It looks like you're using the Playground in "Automatically run" mode. Can you confirm whether the crash happens when using "Manually Run" mode too? You can change this with a long press on the run triangle at the bottom of the playground

@swift-ci
Copy link
Author

Comment by Nhat Le Tien (JIRA)

friss (JIRA User): Cannot reproduce crash with `Manually Run` mode. I just get the result like the picture bellow:
![](Screen Shot 2018-10-25 at 1.48.56 PM.png)

@slavapestov
Copy link
Member

nhatlee89 (JIRA User) as Jordan explained the compiler behavior is correct. However you've found an lldb bug. I can reproduce a crash here but it has a different backtrace than what you were seeing:

Thread 7 Crashed:: <lldb.process.internal-state(pid=40368)>
0   com.apple.LLDB.framework        0x0000000110e08f9d lldb_private::ThreadList::WillResume() + 181
1   com.apple.LLDB.framework        0x0000000110dc08aa lldb_private::Process::PrivateResume() + 252
2   com.apple.LLDB.framework        0x0000000110dc6e13 lldb_private::Process::ShouldBroadcastEvent(lldb_private::Event*) + 849
3   com.apple.LLDB.framework        0x0000000110dc3795 lldb_private::Process::HandlePrivateEvent(std::__1::shared_ptr<lldb_private::Event>&) + 203
4   com.apple.LLDB.framework        0x0000000110dc765e lldb_private::Process::RunPrivateStateThread(bool) + 858
5   com.apple.LLDB.framework        0x0000000110dc6ea6 lldb_private::Process::PrivateStateThread(void*) + 22
6   com.apple.LLDB.framework        0x0000000110d9a3ef lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*) + 105
7   libsystem_pthread.dylib         0x00007fff77759305 _pthread_body + 126
8   libsystem_pthread.dylib         0x00007fff7775c26f _pthread_start + 70
9   libsystem_pthread.dylib         0x00007fff77758415 thread_start + 13

Can you double-check that you attached the right crash logs?

@swift-ci
Copy link
Author

Comment by Fred Riss (JIRA)

Slava, this is a known issue, and the reason why I asked if it happens in Manual mode. Do you get this while running the Playground in Manual mode?

@slavapestov
Copy link
Member

No, I am not able to reproduce it in Manual mode.

@swift-ci
Copy link
Author

Comment by Nhat Le Tien (JIRA)

@slavapestov: I had tried to attached the crash logs in the date I got this crash, so I think those must content the right log for this crash. But don't know if those had the same root cause, because I also used Xcode projects in that date too, not just playground.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LLDB for Swift
Projects
None yet
Development

No branches or pull requests

3 participants