It seems existing versions of gcc don't warn when you use an assignment as a truth value as the first operand to the conditional operator. For example:
int fn(int i) { return (i = 0x20) ? 0x40 : 0x80; }
Presumably you meant ==, but unfortunately that does not warn with gcc (maybe it will one day).
We can use the tree dumping mechanisms (previously mentioned here) to confirm our problem. For the following function gcc creates:
fn (i) { int D.1541; int iftmp.0; i = 32; if (1) { iftmp.0 = 64; } else { iftmp.0 = 128; } D.1541 = iftmp.0; return D.1541; }
As you can see, this isn't the result we wanted. This can be quite nasty if you use the conditional operator in a hidden fashion; for example behind an assert. A common idiom is:
#define ASSERT(x) (x) ? : fail() /* programmer now subsitutes a == for */ ASSERT(x = y);
You'll currently get no warning you've slipped up and used the assert wrong. Moral of the story: a quick audit of your code might turn up some surprising uses! However, in this case, the Intel compiler picks this one up:
$ icc -c test.c test.c(3): warning #187: use of "=" where "==" may have been intended return (i = 0x20) ? 0x40 : 0x80;
Although it's often not trivial to move to another compiler, as a rule I would recommend trying alternative compilers for your code as it's a great sanity check.