[llvm-bugs] [Bug 28344] New: reinterpret_cast throws off static analyzer

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 28 07:03:12 PDT 2016


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

            Bug ID: 28344
           Summary: reinterpret_cast throws off static analyzer
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: eric.huhtala at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

assignment via reinterpret_cast seems to throw off all analysis of that
variable.  

Example Code:

extern unsigned *b;
unsigned f() {

    // if I reassign b via reinterpret_cast, I get "Undefined or garbage value
returned to caller" at g(dummy)
    // if I don't, I get no warning
    unsigned *b = reinterpret_cast<unsigned*>(4);
    unsigned char a = (*b == 0) ? *b : 0;

    unsigned dummy;
    if (a == 0) dummy = 0;
    return dummy;
}

-- 
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/20160628/493a7b20/attachment-0001.html>


More information about the llvm-bugs mailing list