[cfe-dev] Static Analyzer false positive looking into impossible branch

Sean McBride sean at rogue-research.com
Mon Apr 16 09:33:24 PDT 2012


Hi all,

Is it an expected limitation of the clang static analyzer to warn in the C example below?  (This is of course a reduced test case of a real world example.)

-------------
#include <stdlib.h>

int inline never()
{
    return 0;
}

int main()
{
    void *p = 0;
    int n = 0;
    if ( never() ) {
        p = malloc ( n ); // warning: malloc size 0
        free(p);
    } 

    return 0;
}
-------------

Thanks,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada






More information about the cfe-dev mailing list