[cfe-dev] Missing ReturnStmt?

Anna Zaks ganna at apple.com
Fri Mar 23 09:37:06 PDT 2012


All analyzer issues are all printed as warnings. (They are not compilation errors.)

Anna.
On Feb 6, 2012, at 8:53 AM, Zong wrote:

> Hi Ted,
> The dummy example just triggers a warning, I am afraid it shouldn't stop the analyzer, should it?
> 
> Best,
> Z
> 
> 
> At 2012-02-07 00:14:02,"Ted Kremenek" <kremenek at apple.com> wrote:
> The analyzer stops analyzing a path when it hits a fail stop bug (because analyzing the rest of the path would be meaningless).  In this case, *c = b triggers a warning from the analyzer where 'c' is used uninitialized.
> 
> On Feb 6, 2012, at 1:55 AM, Zong <zong_y365 at 163.com> wrote:
> 
>>  Dear All,
>> 
>> I have a very s! imple clang analyzer checker code snippet like below,
>> 
>> --------------------------------------------------
>> using namespace clang;
>> using namespace ento;
>> 
>> namespace {
>>   class myChecker: public Checker< check::PreStmt<Stmt> >  {
>>   public:
>>     void checkPreStmt(const Stmt *S, CheckerContext &Ctx) const ;
>> 
>>   };
>> }
>> 
>> void myChecker::checkPreStmt(const Stmt *S, CheckerContext &Ctx) const {
>>    S->dumpAll();
>> }
>> --------------------------------------------------
>> 
>> This analyzer was then fed with the test code:
>> 
>> int main()
>> {
>>   int *b;
>>   int *c;
>>   *c=b;
>>    return 0;
>> }
>> 
>> Why can't I observe a "ReturnStmt"? 
>> If I change "*c=b" with something other (e.g., b=c), then "ReturnStmt" appears.  I just can! 't figure out the reason. Would someone please help me ? Thanks!
>> 
>> Best,
>> Z
>> 
>> 
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> 
> 
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120323/cece1f4d/attachment.html>


More information about the cfe-dev mailing list