Debugger output does not correspond to actual value of variable

Originator:nih
Number:rdar://36518505 Date Originated:January 15 2018, 12:30 PM
Status:Open Resolved:
Product:Xcode Product Version:9.2
Classification:bug Reproducible:Yes
 
Summary:
For certain combinations of fields in a struct with an embedded struct, the debugger output does not correspond to what is actually stored.

Steps to Reproduce:
1. Create blank Xcode iOS project, Swift
2. Create a struct B like this:
struct B {
    let gpsWeek: UInt16
    let timeOfWeekMillis: UInt32
}
3. Create struct A with 3 fields like this
struct A {
    let telegramId: UInt16
    let timeTag: B
    let remainingPathPts: UInt16
}
4. Create an instance of A:
        let a = A(
            telegramId: 1,
            timeTag: B(gpsWeek: 2, timeOfWeekMillis: 3),
            remainingPathPts: 4)
5. Put a breakpoint below this and run
6. When debugger breaks do a "po a" command

Expected Results:
▿ A
  - telegramId : 1
  ▿ timeTag : B
    - gpsWeek : 3
    - timeOfWeekMillis : 3
  - remainingPathPts : 4

Actual Results:
▿ A
  - telegramId : 1
  ▿ timeTag : B
    - gpsWeek : 3
    - timeOfWeekMillis : 4
  - remainingPathPts : 0

Version/Build:
Xcode Version 9.2 (9C40b)

Configuration:
Attached zip with Xcode project to reproduce. Apart from added file Bugger.swift only 1 line in AppDelegate.swift (to call Bugger) has been changed from Xcode template generated project.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!