First, determine whether the code is really incorrect. Sometimes the operator-precedence rules of ANSI-C do not give the results one would expect, and sometimes faulty code appears correct. Consider the following example.
if (x & y != 0) ... evaluates as: if (x & (y != 0)) ... but not as: if ((x & y) != 0) ...
C's integral promotion rules sometimes produce unexpected behavior. Characters are usually (sign-)extended to integers. This sometimes has unexpected results (refer the following listing).
unsigned char a, b; b = -8; a = ~b; if (a == ~b) ...
The if condition in this example is always false, because extending a results in 0x0007, while extending b gives 0x00F8 and the ~ results in 0xFF07. If the code contains a bug, isolate the construct causing it and send a bug report to Freescale support.