[cfe-dev] C++ analysis vs C analysis

Jean Baptiste LE STANG jb.lestang at gmail.com
Mon Feb 21 08:14:45 PST 2011


OK, thanks. At least a result with false positive is better than no
result at all. I'm going to try with a recent SVN version.

On Mon, Feb 21, 2011 at 5:06 PM, Jean-Daniel Dupas
<devlists at shadowlab.org> wrote:
>
> Le 21 févr. 2011 à 16:57, Jean Baptiste LE STANG a écrit :
>
>> Hello,
>>
>> I'm trying to use LLVM & scan-build (clang 2.8, checker-255) to
>> achieve a static analysis of  a C++ program to detect potential bugs.
>> Before doing it on my real program, I've been trying to make it work
>> on a simple program :
>>
>> int main(int argc, char * argv[] , char * arge[]){
>>        int i;
>>        if (i<5){
>>                i = 50;
>>        }
>>        return i;
>> }
>>
>> First case as a C program : scan-build -k -V -v gcc main.c
>>
>> ANALYZE: main.c main
>> main.c:4:14: warning: The left operand of '<' is a garbage value
>>        if (i<5){
>>
>> Second case as a C++ program :  scan-build -k -V -v g++ main.cpp and
>> i'm missing the previous error detected in scenario 1
>
> The static analyzer does not support C++ yet.
> The svn version starts to support it but it is not ready to use AFAIK.
> I tried it last week, and it reported a lot of false positives.
>
> -- Jean-Daniel
>
>
>
>
>




More information about the cfe-dev mailing list