[LLVMbugs] [Bug 18627] New: Add option to assume pointer is nullable when accessing unilaterally

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 27 00:49:27 PST 2014


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

            Bug ID: 18627
           Summary: Add option to assume pointer is nullable when
                    accessing unilaterally
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: czchen at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Hi,

For the following code, static analyzer does not report potential error when x
is null.

void func(char *x)
{
        strlen(x);
}

I know static analyzer is designed to assume x is non-null due to access
unilaterally because it trusts programmer. However, the problem is in large
legacy code base, programmer might not clearly know the precondition of a
function, or they might take faulty precondition. In these cases, assuming
programmer know what they do is probability not good to find this kind of
problem.

I wonder, is it possible to add a checker for directing pass pointer to nonnull
parameter without assert or if so that we can check for this kind of issue?
Thanks.

Regards,
ChangZhuo

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140127/29b90339/attachment.html>


More information about the llvm-bugs mailing list