It should be fine.
It is not clear what is storage class of b,x1 and x2. It is not clear what CW product version you are using? CW 4.6? Which compiler, C++ for XGATE?
Did you try disassembling C code? Does it look right? Could you show disassembled code for b = x2 - x1? (Use search to find commented C source line in disassembled code).