I have an issue with operator associativity that looks like an unreported bug in CCS 5.1.1. I am compiling a C program for an MSP430F247 processor.
I have two similar statements calling two functions and performing an "and" operation on the function results.
1) ret = (WriteBQAddr(0) & ReadBQ(rPtr));
This one executes as one would expect in the following order according to the associativity of the bit wise and: a) it calls WriteBQAddr first keeping the result locally, b) it then calls ReadBQ and returns a result, c) it performs the bit wise and d) assigns the result to the variable "ret".
2) ret += (WriteBQAddr(0) & ReadBQ(rPtr++));
This one does NOT correctly associate the function calls in the bit .wise and. It executes as: a) it calls ReadBQ first (as it shouldn't) incrementing the pointer and saving the return locally, b) then calls WriteBQAddr, c) then does a bit wise "and" on the two results and d) then sums the result of the and into the variable "ret".
While there are workarounds for this, it seems as obvious disregard for the C operator associativity. Does anyone else have this issue?
Neil
PS. if one removes the rPtr++ pointer increment in the second case, the problem remains. Thus the += seems to confuse the compiler association code.