Confirmed - it's a bug in the lldb IR interpreter.
Here's a link to the patch that fixes it: http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20130520/008569.html
Note that the new test case is exactly your problem:
+ self.expect("expression (int)-2",
+ startstr = "(int) $4 = -2")
+
+ self.expect("expression $4 > (int)31",
+ startstr = "(bool) $5 = false")
So that should keep things working for you in the future!
As far as your code goes, you do have a bug. This condition:
if (dayOfMonth > monthdays.length)
Isn't doing what you want it to. dayOfMonth
is signed, and monthdays.length
is unsigned. That means dayOfMonth
gets promoted to an unsigned type and the comparison goes bad. You'll need a cast in there to clean things up:
if (dayOfMonth > (NSInteger)monthdays.length)