Reputation: 23591
I'm using a struct from cocos3d called CC3IntPoint:
typedef struct {
GLint x; /**< The X-componenent of the point. */
GLint y; /**< The Y-componenent of the point. */
} CC3IntPoint;
When I run my program, it looks normal in the debugger:
(lldb) p pos
(CC3IntPoint) $5 = {
(GLint) x = 48
(GLint) y = 91
}
(lldb) p pos.y
(GLint) $6 = 91
However, if I do any math on pos.y
, it uses pos.x
! For example:
(lldb) p pos.y+1
(int) $7 = 49
(lldb) p pos.y*1
(int) $8 = 48
Am I missing something obvious here? Any ideas on how to fix?
Upvotes: 4
Views: 191
Reputation: 162722
That looks very much like a bug.
Please file it.
I'd say this is some kind of pointer arithmetic magic, but I can't imagine that is the case.
If you really want to explore the issue, I would suggest grabbing the address of various sub-experssions and seeing if you can find where it decides to grab the wrong field.
See Jason's comment on the original question; that should really be the answer.
Upvotes: 2