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-11118] [linux] DateComponents are broken #3993

Closed
swift-ci opened this issue Jul 12, 2019 · 2 comments
Closed

[SR-11118] [linux] DateComponents are broken #3993

swift-ci opened this issue Jul 12, 2019 · 2 comments

Comments

@swift-ci
Copy link
Contributor

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

I tested under Linux, with the following Dockerfile:

FROM swift:5.0.1
WORKDIR /app
COPY Package.swift ./
COPY Sources ./Sources
COPY Tests ./Tests
RUN swift build --product calendar-test --configuration debug
RUN .build/debug/calendar-test
CMD ["echo hello"]
Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: 91fca0ad51833e321b430e3185627379

Issue Description:

The following program crashes for me:

import Foundation

let components = Calendar.current.dateComponents([.month,.year,.day], from: Date(timeIntervalSinceReferenceDate: 0))
print(components)

(It crashes not just for that date, also for `Date()`, but I figured this is more easily reproducible).

@belkadan
Copy link

@spevans, is this another instance of SR-10333?

@spevans
Copy link
Collaborator

spevans commented Jul 16, 2019

Looks to be, its fixed in 5.0.2:

5.0.1

$ ~/swift-5.0.1-RELEASE-ubuntu18.04/usr/bin/swift
error: ld-2.27.so 0xffffffff0005c564: adding range [0x1464a-0x146ba) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0xffffffff0005c564: adding range [0x146d0-0x146d6) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0xffffffff0005c5c5: adding range [0x1464a-0x146ba) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0xffffffff0005c5c5: adding range [0x146d0-0x146d6) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
Welcome to Swift version 5.0.1 (swift-5.0.1-RELEASE).
Type :help for assistance.
  1> import Foundation 
  2.  
  3. let components = Calendar.current.dateComponents([.month,.year,.day], from: Date(timeIntervalSinceReferenceDate: 0)) 
  4. print(components)
Process 28923 stopped
* thread #​1, name = 'repl_swift', stop reason = signal SIGSEGV: invalid address (fault address: 0x18)
    frame #​0: 0x00007ffff3df6860 libFoundation.so`CFLocaleGetIdentifier
libFoundation.so`CFLocaleGetIdentifier:
->  0x7ffff3df6860 <+0>: movq   0x18(%rdi), %rax
    0x7ffff3df6864 <+4>: retq   
    0x7ffff3df6865:      nopw   %cs:(%rax,%rax)
    0x7ffff3df686f:      nop    
Target 0: (repl_swift) stopped.
components: Foundation.DateComponents = {
  _handle = <extracting data from value failed>

}
Execution interrupted. Enter code to recover and continue.
Enter LLDB commands to investigate (type :help for assistance.)
  5>

5.0.2

$ ~/swift-5.0.2-RELEASE-ubuntu18.04/usr/bin/swift
error: ld-2.27.so 0xffffffff0005c564: adding range [0x1464a-0x146ba) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0xffffffff0005c564: adding range [0x146d0-0x146d6) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0xffffffff0005c5c5: adding range [0x1464a-0x146ba) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
error: ld-2.27.so 0xffffffff0005c5c5: adding range [0x146d0-0x146d6) which has a base that is less than the function's low PC 0x14dc0. Please file a bug and attach the file at the start of this error message
Welcome to Swift version 5.0.2 (swift-5.0.2-RELEASE).
Type :help for assistance.
  1> import Foundation 
  2.  
  3. let components = Calendar.current.dateComponents([.month,.year,.day], from: Date(timeIntervalSinceReferenceDate: 0)) 
  4. print(components)
<NSDateComponents: 0x000000000064e360>
components: Foundation.DateComponents = {
  _handle = {
    _pointer = {
      Foundation.NSObject = {}
      _calendar = nil
      _timeZone = nil
      _values = 19 values {
        [0] = 9223372036854775807
        [1] = 2001
        [2] = 1
        [3] = 1
        [4] = 9223372036854775807
        [5] = 9223372036854775807
        [6] = 9223372036854775807
        [7] = 9223372036854775807
        [8] = 9223372036854775807
        [9] = 9223372036854775807
        [10] = 9223372036854775807
        [11] = 9223372036854775807
        [12] = 9223372036854775807
        [13] = 9223372036854775807
        [14] = 9223372036854775807
        [15] = 0
        [16] = 9223372036854775807
        [17] = 9223372036854775807
        [18] = 9223372036854775807
      }
      timeZone = nil
    }
  }
}
  5> 

@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