[cfe-commits] [PATCH] Fix uninitialized variable tracking for compound assignments
Ted Kremenek
kremenek at apple.com
Mon Jul 16 12:55:25 PDT 2012
On Jul 15, 2012, at 10:14 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> The patch replaces the 'track the last DeclRefExpr we saw' technique with a separate pass to classify the DeclRefExprs as use or initialization. Fixing this exposed some "false" positives on some benchmarking code which looks like:
>
> void f() {
> volatile int n;
> for (int i = 0; i < N; ++i)
> n += f();
> }
>
> ... so the patch classifies compound-assignments as neither initialization nor use (it leaves the variable uninitialized if it was before, and leaves it initialized if it was before).
>
Hi Richard,
One comment on this last point. We tend to like avoiding the uninitialized value taint propagating after the first use to avoid a cascade of warnings. Your last comment here implies that were we to flag a warning at "n += f()" we might also flag another warning later if 'n' is used again. Is that true?
Ted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120716/d8ff7f5c/attachment.html>
More information about the cfe-commits
mailing list