[llvm-bugs] [Bug 50645] New: Access to uninitialized volatile stack variable generates warning

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 9 09:28:14 PDT 2021


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

            Bug ID: 50645
           Summary: Access to uninitialized volatile stack variable
                    generates warning
           Product: clang
           Version: 12.0
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: ilya.v.gladyshev at gmail.com
                CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org

Running 'clang-check -analyze' on this simplified example:

    #include <stdbool.h>
    bool test(void)
    {
      volatile int var;

      return var != 0;
    }

gives me: 
sample.c:6:14: warning: The left operand of '!=' is a garbage value
[core.UndefinedBinaryOperatorResult]

To me this looks like a false positive. var is declared as volatile and is
expected to be initialized externally. I have only encountered this problem
with stack variables.

-- 
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/20210609/962e88c2/attachment.html>


More information about the llvm-bugs mailing list