[PATCH] D50488: [Analyzer] Checker for non-determinism caused by sorting of pointer-like elements

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 20 01:07:48 PST 2019


Szelethus added a comment.

In D50488#1403197 <https://reviews.llvm.org/D50488#1403197>, @mgrang wrote:

> > It's because it invokes CodeChecker, which by default enables valist.Uninitialized, but not ValistBase. Do you have assert failures after my hotfix?
>
> @Szelethus Thanks. I run into this assert when run through CodeChecker:
>
>   Assertion `CheckerTags.count(tag) != 0 && "Requested checker is not registered! Maybe you should add it as a " "dependency in Checkers.td?"'
>
>
> Is there a workaround?


Uhh, I'm afraid the only way out is to actually fix the problem :) couple questions:

1. Are you *sure* that you rebased to rC354235 <https://reviews.llvm.org/rC354235> (which is the hotfix I mentioned), CodeChecker runs *that* clang when the assert failure happens?
2. Can you provide a stacktrace? Luckily, that would for sure point me to the problematic checker.

In D50488#1403199 <https://reviews.llvm.org/D50488#1403199>, @mgrang wrote:

> Also I don't see the helptext for PointerSorting when I run:
>
>   clang -cc1 -analyzer-checker-help | grep Pointer
>  
>     alpha.core.PointerArithm        Check for pointer arithmetic on locations other than array elements
>     alpha.core.PointerSub           Check for pointer subtractions on two pointers pointing to different memory chunks
>     alpha.nondeterminism.PointerSorting
>     cplusplus.InnerPointer          Check for inner pointers of C++ containers used after re/deallocation
>


How about `clang -cc1 -analyzer-checker-help | grep Pointer -A3`? There could be a linebreak after the ckecker's name (raises the question though whether it should be there).

In D50488#1403212 <https://reviews.llvm.org/D50488#1403212>, @mgrang wrote:

> > There is a revision to solve this problem here: D58065 <https://reviews.llvm.org/D58065>. I guess your input, as someone who didn't participate in the checker dependency related patch reviews would be invaluable, in terms of whether my description is understandable enough.
>
> Thanks. I took a look at the documentation and it looks fine to me (modulo the comments from other reviewers and a couple of minor typos). I feel the csa-testbench documentation (https://github.com/Xazax-hun/csa-testbench) is very minimal and does not document a lot of intricacies which I had to figure out by trial-and-error.


Due to an upcoming conference, I didn't bother with it much, i just used CodeChecker on its own, which is fairly well documented.
I'm trying to move my checker out of alpha, and my testing goes as follows:

1. Clone LLVM+Clang, cppcheck, rtags, bitcoin, xerces (you could throw in vim, tmux, as your checker isnt C++ exclusive, or whatever else)
2. Create compile_commands.json either with CMake (-DCANE_GENERATE_COMPILE_COMMANDS, or smt similar), or `CodeChecker log`
3. `CodeChecker analyze` projects, paying attention to not forgetting the CodeChecker flag `--verbose debug_analyzer` (and enabling your checker ofc), and piping the output to a file
4. Create a `CodeChecker server`, `CodeChecker store` the results, and stare at the web gui for hours. Its very pretty btw ;)

Csa-testbench is a work in progress, so I guess you can expect more in the future :)

Thanks for your work, even through a few annoyances, very much appreciated!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D50488/new/

https://reviews.llvm.org/D50488





More information about the cfe-commits mailing list