https://llvm.org/bugs/show_bug.cgi?id=24170

            Bug ID: 24170
           Summary: Failure to find double delete
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Created attachment 14604
  --> https://llvm.org/bugs/attachment.cgi?id=14604&action=edit
shows correctly detected error

file1.cpp shows that the analyzer can detect a double delete caused by an
incorrect copy constructor.

$ scan_build clang++ file1.cpp 
scan-build: Using 'clang/bin/clang' for static analysis
file1.cpp:9:9: warning: Attempt to free released memory
        delete [] data;
        ^~~~~~~~~~~~~~


file2.cpp shows how the analyzer fails to detect a similar mistake in a copy
assignment operator.

$ scan_build clang++ file2.cpp 
scan-build: Using '/clang/bin/clang' for static analysis
scan-build: Removing directory '/tmp/scan-build-2015-07-17-211038-16264-1'
because it contains no reports.
scan-build: No bugs found

$ clang -v
clang version 3.8.0 (trunk 242502)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation:
gcc4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2
Found candidate GCC installation:
gcc4.9.2/lib64/gcc/x86_64-unknown-linux-gnu/4.9.2
Selected GCC installation: gcc4.9.2/lib64/gcc/x86_64-unknown-linux-gnu/4.9.2
Candidate multilib: .;@m64
Selected multilib: .;@m64

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to