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-10333] Calendar.current.dateComponents([.weekday], from: Date()).weekday segfaults #3493

Closed
weissi opened this issue Apr 7, 2019 · 7 comments

Comments

@weissi
Copy link
Member

weissi commented Apr 7, 2019

Previous ID SR-10333
Radar None
Original Reporter @weissi
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 2
Component/s Foundation
Labels Bug, 5.0Regression, RunTimeCrash
Assignee @spevans
Priority Medium

md5: cb89f104dfb391a44fefac5c708aff9f

Issue Description:

Thanks to mikeisaev (JIRA User) we were just able to reduce the crasher to something really basic. This simple Swift program

Calendar.current.dateComponents([.weekday], from: Date()).weekday

just crashes. The problem is that transitively CFLocaleGetIdentifier gets called with

  1> import Foundation
  2> Calendar.current.dateComponents([.weekday], from: Date()).weekday
Execution interrupted. Enter code to recover and continue.
Enter LLDB commands to investigate (type :help for assistance.)
Process 481 stopped
* thread #​1, name = 'repl_swift', stop reason = signal SIGSEGV: invalid address (fault address: 0x18)
    frame #​0: 0x00007ffff3df8c50 libFoundation.so`CFLocaleGetIdentifier
libFoundation.so`CFLocaleGetIdentifier:
->  0x7ffff3df8c50 <+0>: movq   0x18(%rdi), %rax
    0x7ffff3df8c54 <+4>: retq   
    0x7ffff3df8c55:      nopw   %cs:(%rax,%rax)
    0x7ffff3df8c5f:      nop    
Target 0: (repl_swift) stopped.
@weissi
Copy link
Member Author

weissi commented Apr 7, 2019

@millenomi/@spevans seen anything like this before?

@millenomi
Copy link
Contributor

What version of Swift is this? What is the environment (eg. LANG)?

@swift-ci
Copy link
Contributor

swift-ci commented Apr 7, 2019

Comment by Mikhail Isaev (JIRA)

lldb version 7.0.0 (git@github.com:apple/swift-lldb.git revision 3d9fc38bfd8cbe56fa4ee3904e996c933566bb08)
Swift-5.0 (revision ba33f9e0b772015326bdecc0d597b2ac9fc61717)
clang revision 5c9d04dc0697297a47b5edb0c1a581b306a42bdb
llvm revision 3207a50965a98cdc2f42a934f158c38182be7257

@swift-ci
Copy link
Contributor

swift-ci commented Apr 7, 2019

Comment by Mikhail Isaev (JIRA)

Ubuntu 16.04 on DigitalOcean

@weissi
Copy link
Member Author

weissi commented Apr 7, 2019

LANG we saw this with en_US.UTF-8 and POSIX

@weissi
Copy link
Member Author

weissi commented Apr 8, 2019

Thanks @spevans ! #2067

@swift-ci
Copy link
Contributor

swift-ci commented May 2, 2019

Comment by Andrew Theis (JIRA)

To anyone who finds this bug, the workaround is to create your own Calendar instance.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants