Hi Chris:

Very interesting.  Yes, I'm interested in the bugs that static analysis found.  
Some appear pretty easy to correct.
I think the refactoring of setupError/handleError is worth considering.

THH
________________________________
From: Chris Wailes [[email protected]]
Sent: Tuesday, April 15, 2014 2:36 PM
To: [email protected]
Subject: [Chapel-developers] Results from Clang Static Analysis

I needed some screenshots of results from the Clang static analyzer so I ended 
up running the tool on the Chapel code base ("export CHPL_HOST_COMPILER=cxx; 
scan-build make").  The report that it generated included some interesting 
items.

Some of the items were lint.  The malloc-lint image attached shows one example 
of this.  A more subtle bug might be shown in the dead-assignment image.  Here 
an assignment in one branch is not used, while an assignment to the same 
variable is used in another branch.  Is assignment to the functionTypeMap array 
supposed to occur outside the if-statement?  (A bonus use-after-free bug is 
also included.)

A number of items in the report are of dubious validity due to the nature of 
the setupError and handleError functions.  Because multiple assertion types map 
down to handleError, and only some of these assertion types cause the compiler 
to exit, the handleError methods can't be annotated with the `noreturn` 
attribute, which would allow the static analyzer to obtain a much more precise 
results.

My questions to the mailing list are then A) are people interested in the 
current list of "bugs" that the Clang analyzer found and 2) is there interest 
in re-factoring the setupError/handleError infrastructure to allow the 
appropriate annotation of functions that don't return, thereby allow the 
analyzer to produce more accurate and useful reports in the future?

Just some food for thought.

- Chris
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to