The patch is simple:<br><br>Index: lib/Analysis/GRExprEngine.cpp<br>===================================================================<br>--- lib/Analysis/GRExprEngine.cpp (版本 51366)<br>+++ lib/Analysis/GRExprEngine.cpp (工作副本)<br>
@@ -1596,7 +1596,7 @@<br> if (asLVal)<br> MakeNode(Dst, U, *I, SetRVal(St, U, location));<br> else<br>- EvalLoad(Dst, Ex, *I, St, location);<br>+ EvalLoad(Dst, U, *I, St, location);<br>
} <br> <br> return;<br><br>Test case:<br><br>int foo(void) {<br> int i;<br> int *p = &i;<br> if (*p > 0)<br> return 0;<br> else<br> return 1;<br>}<br><br>Before patch:<br>no warning<br><br>After patch:<br>
ANALYZE: 2.c foo<br>2.c:4:3: warning: [CHECKER] Branch condition evaluates to an uninitialized value.<br> if (*p > 0)<br> ^ ~~<br>1 diagnostic generated.<br><br>Reason:<br>The loaded value should be set to the UnaryOperator *p, but not its subexpr p.<br>
<br>Note:<br>This patch is very likely incomplete. GRExprEngine::EvalLoad() might also be modified. Ted should do better than me.<br>