Hi Russ, On 14.12.20 01:23, Russ Allbery wrote: > (Apologies, I haven't reported these upstream since they want bug > reporters to catch them on IRC to get a Trac account created.)
Yes, the problems with account creation are very unfortunate. I'll forward your test cases, but before doing so, let me double-check ...
The common theme in all three cases is that a variable is passed by address to another function (via adding its address to a struct or just directly), and cppcheck loses track of the fact that function may have changed its value. In the first case, I think the (void *) cast is the key. If it's removed, cppcheck understands the code correctly. (But this is sometimes required by badly-designed APIs.)
Ok, confirmed.
In the second case, something about adding retval to the test messes up its understanding of the data flow.
Removing retval from the if() condition does not change anything for me. Could you double-check?
The third case seems similar to the previous set of bugs, although note that it only happens with assignment. If that line is instead replaced with something like call_c(foo->flag), there is no error.
I suppose you meant replacing "blah.flag = foo->flag;" by "call_c(foo->flag)"? This does not change anything for me.
Is "call_b(&blah);" relevant in this test? Best regards, Joachim