http://llvm.org/bugs/show_bug.cgi?id=21796

            Bug ID: 21796
           Summary: core.NullDereference doesn't check assign of function
                    output
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

core.NullDereference checker can check whether code is dereferencing pointer
that was previously initialized to NULL (or zero) by assignment, but for some
reason it doesn't warn about dereferencing when pointer was initialized to NULL
by calling a function (that returns NULL).

This is smallest testcase how to reproduce it:

int *init() {
    return 0;
}

int main() {
    int *p = init();
    *p = 10;
}

Running static analysis on this code doesn't result in warning about
dereferencing NULL, but when you replace "init()" call with "0", it does show
warning.

-- 
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