Example code:
void f1(int x) { int a[20] = {0}; if (x==25) {} if (a[x] == 123) {} // <- Warning }
If I don't enable alpha, only core, then Clang writes this misleading FP:
undef.c:5:12: warning: The left operand of '==' is a garbage value
I say it's a FP because the message is wrong. If the message correctly said "array index out of bounds" and pointed out a[x] directly, then it would be TP. This message goes away if alpha is enabled and I believe that is by intention.
Since there is a array-index-out-of-bounds check in alpha I am guessing that the UndefinedBinaryOperatorResult should not report "array index out of bounds". Therefore I remove this warning from this check.
This patch is a experimental work in progress. I would like to know if you think I should modifiy the UndefinedBinaryOperatorResult check or if I should do something in the ExprEngine? Maybe array index out of bounds should not lead to Undef SVal?
With this patch, all the existing tests succeed.