I just noticed some other distressing behavior related to Codewarrior 7.1.2. Note the simple 'if' expression on the third line here. Using CW 6.3 and 7.1 (as well as the simulator), the expression evaluates correctly. But under CW 7.1.2, it always evaluates to false. Using 'and' instead of 'or' in the expression works fine. This problem happens with any level of optimization other than none.
if(!uStrncasecmp(p, "z1", 2)) {
type = *(p+1) - 0x30;
if((type == 1) || (type == 2))
uPrintf("(%d == 1) || (%d == 2) is true\r\n", type, type);
else
uPrintf("(%d == 1) || (%d == 2) is false\r\n", type, type);
if((type >= 1) && (type <= 2))
uPrintf("(%d >= 1) && (%d <= 2) is true\r\n", type, type);
else
uPrintf("(%d >= 1) || (%d <= 2) is false\r\n", type, type);
}
Simulator output:
(1 == 1) || (1 == 2) is true
(1 >= 1) && (1 <= 2) is true
Target output:
(1 == 1) || (1 == 2) is false
(1 >= 1) && (1 <= 2) is true