Discussion:
Clang static analyzer results
Yaakov (Cygwin/X)
2012-01-27 10:56:41 UTC
Permalink
I just added the clang-analyzer to the pending LLVM/Clang ITP, and what
better way to test it than on the Cygwin codebase itself. Here are the
results for CVS HEAD as of yesterday:

http://cygwin-ports.sourceforge.net/scan-build/

Obviously it will still take knowledgeable human intervention to judge
the actual severity of these "bugs", but so far it does seem that there
is some useful information here which we may want to take into account.

HTH,


Yaakov
Christopher Faylor
2012-07-02 20:04:33 UTC
Permalink
Post by Yaakov (Cygwin/X)
I just added the clang-analyzer to the pending LLVM/Clang ITP, and what
better way to test it than on the Cygwin codebase itself. Here are the
http://cygwin-ports.sourceforge.net/scan-build/
Obviously it will still take knowledgeable human intervention to judge
the actual severity of these "bugs", but so far it does seem that there
is some useful information here which we may want to take into account.
Many months later, I thought maybe the above might have uncovered
something which would shed some light on the stack problems that I
noted. It didn't but I did take a swing through this report and
eliminated some of the more obvious issues.

Any chance, you could rerun this Yaakov? I promise to look at it within
the next three months if so. That will more than half the amount of
time it took me to look at your last report.

Btw, Clang doesn't actually build a usable version of Cygwin does it?

cgf
Teemu Nätkinniemi
2012-07-02 20:28:03 UTC
Permalink
Post by Christopher Faylor
Post by Yaakov (Cygwin/X)
I just added the clang-analyzer to the pending LLVM/Clang ITP, and what
better way to test it than on the Cygwin codebase itself. Here are the
http://cygwin-ports.sourceforge.net/scan-build/
Obviously it will still take knowledgeable human intervention to judge
the actual severity of these "bugs", but so far it does seem that there
is some useful information here which we may want to take into account.
Many months later, I thought maybe the above might have uncovered
something which would shed some light on the stack problems that I
noted. It didn't but I did take a swing through this report and
eliminated some of the more obvious issues.
FYI, PVS-Studio support GCC nowadays and there's always Cppcheck as
well. PVS-Studio officially supports GCC with MinGW but I've been
testing it with Cygwin/MSYS and it does give some results.

http://www.viva64.com/en/pvs-studio/

http://cppcheck.sourceforge.net/
Yaakov (Cygwin/X)
2012-07-03 21:47:55 UTC
Permalink
Post by Christopher Faylor
Post by Yaakov (Cygwin/X)
I just added the clang-analyzer to the pending LLVM/Clang ITP, and what
better way to test it than on the Cygwin codebase itself. Here are the
http://cygwin-ports.sourceforge.net/scan-build/
Many months later, I thought maybe the above might have uncovered
something which would shed some light on the stack problems that I
noted. It didn't but I did take a swing through this report and
eliminated some of the more obvious issues.
Any chance, you could rerun this Yaakov?
Done and uploaded to the same location.
Post by Christopher Faylor
I promise to look at it within the next three months if so. That
will more than half the amount of time it took me to look at your
last report.
:-)
Post by Christopher Faylor
Btw, Clang doesn't actually build a usable version of Cygwin does it?
I haven't tried yet. Clang didn't handle PE C++ exceptions as of 3.0:

http://cygwin.com/ml/cygwin/2012-02/msg00025.html

But the bugzilla entry mentioned there seems to indicate that 3.1 might
work. If I can get my other llvm-dependent packages to build with 3.1,
I'll give it a shot when I have a chance.


Yaakov
Christopher Faylor
2012-07-03 22:12:35 UTC
Permalink
Post by Yaakov (Cygwin/X)
Post by Christopher Faylor
Post by Yaakov (Cygwin/X)
I just added the clang-analyzer to the pending LLVM/Clang ITP, and what
better way to test it than on the Cygwin codebase itself. Here are the
http://cygwin-ports.sourceforge.net/scan-build/
Many months later, I thought maybe the above might have uncovered
something which would shed some light on the stack problems that I
noted. It didn't but I did take a swing through this report and
eliminated some of the more obvious issues.
Any chance, you could rerun this Yaakov?
Done and uploaded to the same location.
Did you update your tree before doing this? It seems like some of the
problems that I fixed yesterday are still there.
Post by Yaakov (Cygwin/X)
Post by Christopher Faylor
I promise to look at it within the next three months if so. That
will more than half the amount of time it took me to look at your
last report.
:-)
Post by Christopher Faylor
Btw, Clang doesn't actually build a usable version of Cygwin does it?
http://cygwin.com/ml/cygwin/2012-02/msg00025.html
AFAIK, we don't use C++ exceptions in the DLL do we?

cgf
Yaakov (Cygwin/X)
2012-07-04 00:36:53 UTC
Permalink
Post by Christopher Faylor
Post by Yaakov (Cygwin/X)
Done and uploaded to the same location.
Did you update your tree before doing this? It seems like some of the
problems that I fixed yesterday are still there.
Yes, I did cvs up just before, and a cvs up now shows nothing new.
Post by Christopher Faylor
Post by Yaakov (Cygwin/X)
Post by Christopher Faylor
Btw, Clang doesn't actually build a usable version of Cygwin does it?
http://cygwin.com/ml/cygwin/2012-02/msg00025.html
AFAIK, we don't use C++ exceptions in the DLL do we?
I'll give it a try with 3.0 in the meantime.


Yaakov
Christopher Faylor
2012-07-04 01:23:14 UTC
Permalink
Post by Yaakov (Cygwin/X)
Post by Christopher Faylor
Post by Yaakov (Cygwin/X)
Done and uploaded to the same location.
Did you update your tree before doing this? It seems like some of the
problems that I fixed yesterday are still there.
Yes, I did cvs up just before, and a cvs up now shows nothing new.
For example:

http://cygwin-ports.sourceforge.net/scan-build/cygwin/report-St4iCx.html#EndPath

I added a "goto out" to alleviate this problem but the web page still shows
it as evident.

cgf
jojelino
2012-08-30 01:12:22 UTC
Permalink
Post by Christopher Faylor
Post by Yaakov (Cygwin/X)
Post by Christopher Faylor
Post by Yaakov (Cygwin/X)
Done and uploaded to the same location.
Did you update your tree before doing this? It seems like some of the
problems that I fixed yesterday are still there.
Yes, I did cvs up just before, and a cvs up now shows nothing new.
http://cygwin-ports.sourceforge.net/scan-build/cygwin/report-St4iCx.html#EndPath
I added a "goto out" to alleviate this problem but the web page still shows
it as evident.
cgf
And here is another clang-analyzer result.
http://jojelino.net78.net/2012-08-30/
during this work, clang complained about gcc extension
http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Conditionals.html seen too
often throughout cygwin source code. although i fixed the roadblock
before obtaining above result.
--
Regards.
jojelino
2012-08-30 03:09:25 UTC
Permalink
Post by jojelino
Post by Christopher Faylor
Post by Yaakov (Cygwin/X)
Post by Christopher Faylor
Post by Yaakov (Cygwin/X)
Done and uploaded to the same location.
Did you update your tree before doing this? It seems like some of the
problems that I fixed yesterday are still there.
Yes, I did cvs up just before, and a cvs up now shows nothing new.
http://cygwin-ports.sourceforge.net/scan-build/cygwin/report-St4iCx.html#EndPath
I added a "goto out" to alleviate this problem but the web page still shows
it as evident.
cgf
And here is another clang-analyzer result.
http://jojelino.net78.net/2012-08-30/
during this work, clang complained about gcc extension
http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Conditionals.html seen too
often throughout cygwin source code. although i fixed the roadblock
before obtaining above result.
Produced report for cygserver cygwin lsaauth newlib utils. available in
http://jojelino.net78.net/
--
Regards.
Peter Rosin
2012-08-30 06:50:03 UTC
Permalink
Post by jojelino
And here is another clang-analyzer result.
http://jojelino.net78.net/2012-08-30/
That URL is no longer working.
Post by jojelino
during this work, clang complained about gcc extension
http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Conditionals.html seen too
often throughout cygwin source code. although i fixed the roadblock
before obtaining above result.
Produced report for cygserver cygwin lsaauth newlib utils. available in http://jojelino.net78.net/
I had a random look at a couple of them for cygwin proper, but
stopped when I reached the "Memory Error Double free" in
nlsfuncs.cc:828. That's just a crazy report, it claims that
memory is released by a failing realloc call and that you don't
need to free the memory at the pointer you failed to realloc.
Someone should report that as a bug in clang.

Cheers,
Peter

Yaakov (Cygwin/X)
2012-07-04 03:46:12 UTC
Permalink
Post by Christopher Faylor
Btw, Clang doesn't actually build a usable version of Cygwin does it?
I'm sorry to report that Clang doesn't build winsup/cygwin at all, at
least not with -Werror. Error log for winsup/cygwin attached.


Yaakov
Loading...