swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.57k stars 10.36k forks source link

[SR-10473] Swift 5: Sometimes repro crash comparing sets #52873

Open swift-ci opened 5 years ago

swift-ci commented 5 years ago
Previous ID SR-10473
Radar None
Original Reporter deirdresm (JIRA User)
Type Bug
Environment Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3) Target: x86_64-apple-darwin18.5.0
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 0bfad18894fbc1897d2c168e675136ba

Issue Description:

This crashes when using Swift at the Terminal command line, but not in Playgrounds.

Code via Paul Hudson:

var spaceships1 = Set<String>()
spaceships1.insert("Serenity")
spaceships1.insert("Enterprise")
spaceships1.insert("TARDIS")
let spaceships2 = spaceships1
if spaceships1.isSubset(of: spaceships2) {
print("This is a subset")
} else {
print("This is not a subset")
}

result was:

spaceships1: Set<String> =Process 5906 stopped
* thread #&#8203;1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x74)
 frame #&#8203;0: 0x00007fff75a0d1a0 libswiftCore.dylib`swift_beginAccess + 96
libswiftCore.dylib`swift_beginAccess:
-> 0x7fff75a0d1a0 <+96>: movq 0x10(%rdx), %rsi
 0x7fff75a0d1a4 <+100>: cmpq %rbx, (%rdx)
 0x7fff75a0d1a7 <+103>: jne 0x7fff75a0d1bc ; <+124>
 0x7fff75a0d1a9 <+105>: testq %r12, %r12
Target 0: (repl_swift) stopped.
 <extracting data from value failed>
spaceships2: Set<String> = <extracting data from value failed>
Execution interrupted. Enter code to recover and continue.

I hadn't had any crashes before in that Swift session, but after a reboot I can't reproduce it, though I could reproduce it several times before the reboot.

belkadan commented 5 years ago

Very strange, but since we're not able to reproduce it either I'm not sure how actionable it is. @lorentey, have you heard of regressions in Set recently?

lorentey commented 5 years ago

Not in swift_beginAccess, no. Hm.

deirdresm (JIRA User), is there any chance the command line variant could've picked up a swiftc from a snapshot package (e.g., through the DEVELOPER_DIR environment variable)? Not that I'd expect a crash then, but it may help pinpointing an issue.

swift-ci commented 5 years ago

Comment by Deirdre Saoirse Moen (JIRA)

I did have a nightly build on my computer, but shouldn't it have reported that in the version were it invoked?

swift-ci commented 5 years ago

Comment by Deirdre Saoirse Moen (JIRA)

I can't reproduce this, so recommend closing.