Here's my entire code:
Task {
try! await Task.sleep(nanoseconds: 1_000_000)
print("Hello")
}
Guess what it outputs? (Hint: it's not "Hello")
That's right, it segfaults!
Segmentation fault (core dumped)
💣 Program crashed: Bad pointer dereference at 0x00007f931bfd0220
Thread 1 crashed:
0 0x00007f931bc5783e <unknown> in libgcc_s.so.1
1 0x00007f931a2c6f48
On further testing this seems to be sporadic -- usually it does print "Hello" -- but why can this even happen?
For environment info: this happened on SwiftFiddle with Swift 5.9.