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-2485] Segmentation fault in Date #4331

Closed
swift-ci opened this issue Aug 25, 2016 · 4 comments
Closed

[SR-2485] Segmentation fault in Date #4331

swift-ci opened this issue Aug 25, 2016 · 4 comments

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-2485
Radar None
Original Reporter sigge75 (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

Ubuntu 15.10 Desktop on Parallels 12
MacBook Pro ca 2012 (1st gen retina), OSX El Capitan

Additional Detail from JIRA
Votes 2
Component/s Foundation
Labels Bug, Linux, RunTimeCrash
Assignee None
Priority Medium

md5: eadbe71e96fe163f2418e8f283419c9e

relates to:

  • SR-2462 Compiler is sometimes overreleasing CF objects

Issue Description:

Printing date 4 times triggers segmentation fault. The following code prints the date three times. It is always on the fourth iteration the segfault occurs.

for _ in 0..<4 { print(Date()) }

The bug apparently is in Date.description. The following code behaves similarly:

for _ in 0..<4 { _ = Date().description }

(swift-DEVELOPMENT-SNAPSHOT-2016-08-24-a)

@belkadan
Copy link

Possibly SR-2462?

@swift-ci
Copy link
Contributor Author

Comment by W S (JIRA)

It might be getting worse :-)

Welcome to Swift version 3.0-dev (LLVM fff9c29ba5, Clang e7fc81033c, Swift b03e7c3385). Type :help for assistance.
1> import Foundation
2> let date = Date()
date: Foundation.Date = 2016-09-27 03:26:32 GMT
3> date.description
$R0: String = "2016-09-27 03:26:32 +0000"
4> date.description
Execution interrupted. Enter code to recover and continue.
Enter LLDB commands to investigate (type :help for assistance.)
5>

@swift-ci
Copy link
Contributor Author

Comment by W S (JIRA)

Does seem related to time zone memory management as in SR-2462

@spevans
Copy link
Collaborator

spevans commented Aug 27, 2018

This was fixed in Swift 3.1

$ cat sr_2485.swift 
import Foundation

for _ in 0..<4 { print(Date()) }

$ ~/swift-3.1-RELEASE-ubuntu16.04/usr/bin/swift sr_2485.swift 
2018-08-27 19:26:40 +0000
2018-08-27 19:26:40 +0000
2018-08-27 19:26:40 +0000
2018-08-27 19:26:40 +0000 

@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