<div dir="ltr">I'm having some trouble understanding exactly under what circumstances I can construct a "known" sval for various expressions.<div><br></div><div>Here's a concrete example that I ran into and was surprised about:</div>
<div><br></div><div>int f(float x){</div><div>  return (int)x;</div><div>}</div><div><br></div><div>int main(int argc, char** argv){</div><div>   int x = -1;</div><div>   f(x);</div><div>   return 0;</div><div>}</div><div>
<br></div><div>I then created a checker that registered for the PreCall check. When checkPreCall was invoked, Call.getArgSVal(0) is unknown, which makes sense to me because the system doesn't reason about floating-point, however, I was surprised that this also results in an unknown value (regardless of it's overall sensibility):</div>
<div><br></div><div>C.getState()->getSVal(dyn_cast<ImplicitCastExpr>(Call.getArgExpr(0)->getSubExpr()))</div><div><br></div><div>Indeed, if I change the definition of f so that it becomes:</div><div><br></div>
<div>int f(int x){</div><div>  return x;</div><div>}</div><div><br></div><div>Then Call.getArgSVal(0) is known and insofar as I can tell should be equivalent to the above in the earlier context. I'd be interested to understand why that's not the case and in general what expressions can be converted to usable svals during the check calls.</div>
<div><br></div><div>Thanks!</div><div><br></div><div>-Mike</div></div>