This is an archive of the discontinued LLVM Phabricator instance.

[Analyzer] Report every bug if only uniqueing location differs.
ClosedPublic

Authored by balazske on Jul 2 2020, 11:57 PM.

Details

Summary

Two CSA bug reports where only the uniqueing location is different
should be treated as different problems. The role of uniqueing location
is to differentiate bug reports.

Diff Detail

Event Timeline

balazske created this revision.Jul 2 2020, 11:57 PM
clang/lib/Analysis/PathDiagnostic.cpp
333

Why this asymmetry?

389

Asymmetry again. What if YUL is valid?

balazske marked 2 inline comments as done.Jul 3 2020, 3:46 AM
balazske added inline comments.
clang/lib/Analysis/PathDiagnostic.cpp
333

The function returns something like "XL is less than YL". The invalid source locations should come always as first (or last?) in the ordering.

389

Here we have already a precondition that XUL == YUL (from line 358).

Szelethus added a subscriber: NoQ.
Szelethus added inline comments.
clang/lib/Analysis/PathDiagnostic.cpp
1136–1137

This looks a bit odd -- why do we need both of these?

Also, didn't we use uniqueing location in the BugReportEquivClass or whatever its called? Why do we need to add this here as well? I would like some technical explanation.

clang/test/Analysis/malloc.c
793

On an unrelated note, shouldn't one of the notes be here? @NoQ, is this the same issue as the one you raised with zombie symbols? http://lists.llvm.org/pipermail/cfe-dev/2016-March/047922.html

clang/test/Analysis/pr22954.c
346–357

What a god awful test case.

NoQ accepted this revision.Jul 13 2020, 10:38 PM
NoQ added inline comments.
clang/lib/Analysis/PathDiagnostic.cpp
1136–1137

As of now it probably does nothing. But technically we allow our users to set a completely arbitrary uniqueing decl that doesn't necessarily correspond to the uniqueing location, so we'll probably need to take it into account.

Generally, uniqueing decls are for uniqueing and otherwise identifying bugs regardless of slight changes in the source code. Currently this means issue hashes.

clang/test/Analysis/malloc.c
793

The warning about the first malloc indeed probably required the zombie symbol bug to be fixed. That said, the warning isn't really guaranteed to be on that line, because there's no guarantee that dead symbol collection runs *immediately* after the overwrite (which causes the symbol to become dead), and the overwrite is in fact the last thing that happens in this function.

This revision is now accepted and ready to land.Jul 13 2020, 10:38 PM
This revision was automatically updated to reflect the committed changes.
NoQ added a comment.Jul 28 2020, 4:22 PM

Whoops, i meant to post the comment in https://reviews.llvm.org/rG22a084cfa337d5e5ea90eba5261f7937e28d250b#937772 here. Anyway, i found a crash caused by this patch.

Crash is fixed here: D84843