Expected behaviour of the analyzer with alpha.unix.Stream checker.

Hi All,

I've a question regarding the non-deterministic results that I encounter applying the analyzer on the attached test case.

Command executed(here without search paths for includefile):
/tmp/build/Debug+Asserts/bin/clang++ -cc1 -analyze -analyzer-store region test__alpha_unix_Stream.cc -analyze-function main -analyzer-checker=alpha.unix.Stream

$ /tmp/build/Debug+Asserts/bin/clang++ -v
clang version 3.3 (trunk 176090)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Sometimes the run does not report bug, and sometime report:
  test__alpha_unix_Stream.cc:28:3: warning: Opened File never closed. Potential Resource leak

I cannot understand if this is the expected behaviour, or mine mistake on analyzer's invocation, or a bug in the alpha.unix.Stream checker or elsewhere.

  Thanks
   Marco

test__alpha_unix_Stream.cc (398 Bytes)

Hi, Marco. Non-determinism is always considered a bug in the analyzer. However, running the analyzer through the -cc1 interface is unstable and deliberately unsupported; at the very least, you need to include the 'core' checkers yourself when you run with -cc1 (-analyzer-checker=core).

The usual way to run the analyzer with a custom checker enabled is like this:

clang++ --analyze -Xclang -analyzer-checker=alpha.unix.Stream test__alpha_unix_Stream.cc

With the core checkers enabled, do you still see this nondeterminism?
Jordan

P.S. Of course, the alpha checkers are marked "alpha" for a reason—they're checkers we feel are not ready for broad use beause they haven't been thoroughly tested. You may well have found a real bug.

Thank you Jordan for your clarifications.

With the suggested way:
> /tmp/build/Debug+Asserts/bin/clang++ --analyze -Xclang -analyzer-checker=alpha.unix.Stream test__alpha_unix_Stream.cc

I'm still seeing the nondeterminism.

  Marco

Hm, interesting. I didn't see it locally in a couple of repeated runs, but please file a bug anyway. (http://llvm.org/bugs/)