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-13979] Calendar.nextDate() segmentation fault on linux, not on OSX #4382

Closed
swift-ci opened this issue Dec 21, 2020 · 2 comments
Closed

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-13979
Radar rdar://problem/72558641
Original Reporter tamc (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

On OSX:

Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
Target: x86_64-apple-darwin20.2.0

On Linux (using swift:latest docker image):

Swift version 5.3.2 (swift-5.3.2-RELEASE)
Target: x86_64-unknown-linux-gnu

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: d3e1b1bc74a6ecaa3eca00e9a2f93760

Issue Description:

This code:

import Foundation

let calendar = Calendar.current
let after = Date(timeIntervalSinceReferenceDate: 599529600.0) // i.e., 2020/1/1
let components = DateComponents(year: 2019, month: 1, day: 1, hour: 0, minute: 0, second: 0)
let next = calendar.nextDate(after: after, matching: components, matchingPolicy: .nextTimePreservingSmallerComponents, direction: .forward)
print("The next \(components) after \(after) will be: \(String(describing: next))")

Will output this on osx:

swift linux-check.swift
The next year: 2019 month: 1 day: 1 hour: 0 minute: 0 second: 0 isLeapMonth: false  after 2020-01-01 00:00:00 +0000 will be: nil

But on linux will produce:

swift linux-check.swiftswift linux-check.swiftStack dump:0. Program arguments: /usr/bin/swift -frontend -interpret linux-check.swift -disable-objc-interop -color-diagnostics -module-name main1. Swift version 5.3.2 (swift-5.3.2-RELEASE)2. While running user code "linux-check.swift"/usr/bin/swift[0x51fa1c4]/usr/bin/swift[0x51f7dbe]/usr/bin/swift[0x51fa49c]/lib/x86_64-linux-gnu/libpthread.so.0(+0x12980)[0x7f663caa8980]/usr/lib/swift/linux/libFoundation.so($sSo9CFDateRefa10FoundationE12_swiftObjectAC4DateVvg+0x6)[0x7f6631f186a6]/usr/lib/swift/linux/libFoundation.so(+0x385ee7)[0x7f6631efdee7]/usr/lib/swift/linux/libFoundation.so(+0x37dfb3)[0x7f6631ef5fb3]/usr/lib/swift/linux/libFoundation.so(_CFCalendarEnumerateDates+0x217a)[0x7f6632095cba]/usr/lib/swift/linux/libFoundation.so($s10Foundation10NSCalendarC14enumerateDates13startingAfter8matching7options5usingyAA4DateV_AA0J10ComponentsVAC7OptionsVyAJSg_SbSpyAA8ObjCBoolVGtXEtF+0x2fc)[0x7f6631ef5e7c]/usr/lib/swift/linux/libFoundation.so($s10Foundation22_NSCopyOnWriteCalendarC14enumerateDates13startingAfter8matching7options5usingyAA4DateV_AA0M10ComponentsVAA10NSCalendarC7OptionsVyAJSg_SbSpyAA8ObjCBoolVGtXEtF+0x46)[0x7f6631ef80e6]/usr/lib/swift/linux/libFoundation.so($s10Foundation10NSCalendarC8nextDate5after8matching7optionsAA0D0VSgAI_AA0D10ComponentsVAC7OptionsVtF+0x31)[0x7f6631ef6011]/usr/lib/swift/linux/libFoundation.so(+0x297ce6)[0x7f6631e0fce6]/usr/lib/swift/linux/libFoundation.so(+0x297074)[0x7f6631e0f074]/usr/lib/swift/linux/libFoundation.so(+0x299509)[0x7f6631e11509]/usr/lib/swift/linux/libFoundation.so($s10Foundation14_MutableHandleC3mapyqd__qd__xKXEKlF+0x4a)[0x7f6631dfe56a]/usr/lib/swift/linux/libFoundation.so($s10Foundation8CalendarV8nextDate5after8matching0F6Policy012repeatedTimeG09directionAA0D0VSgAK_AA0D10ComponentsVAC08MatchingG0OAC08RepeatediG0OAC15SearchDirectionOtF+0x61)[0x7f6631e0b071][0x7f663cedc28f]/usr/bin/swift[0x59cab3]/usr/bin/swift[0x589166]/usr/bin/swift[0x56ecca]/usr/bin/swift[0x561ef0]/usr/bin/swift[0x55f069]/usr/bin/swift[0x4e8ce8]/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f663b0f6bf7]/usr/bin/swift[0x4e888a]Segmentation fault
@typesanitizer
Copy link

@swift-ci create

@spevans
Copy link
Collaborator

spevans commented Dec 22, 2020

#2957

@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