[llvm-bugs] [Bug 32925] New: analyser reports real issue, but misses use of undefined variable on the way

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 4 09:27:37 PDT 2017


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

            Bug ID: 32925
           Summary: analyser reports real issue, but misses use of
                    undefined variable on the way
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: analyze
          Assignee: unassignedbugs at nondot.org
          Reporter: yann.dirson at blade-group.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 18410
  --> https://bugs.llvm.org/attachment.cgi?id=18410&action=edit
buggy for/else

Behaviour observer in 3.8, 3.9, 4.0, and snapshot of 5.0 in Debian

$ scan-build clang++ -c ./src/foo.cpp
scan-build: Using '/usr/lib/llvm-3.8/bin/clang' for static analysis
./src/foo.cpp:28:20: warning: Dereference of undefined pointer value
    printf("%d\n", p->d);
                   ^~~~
1 warning generated.
scan-build: 1 bug found.


This is a buggy implementation of a pythobun-like "for / else" idiom.

In the path leading to this, which corresponds to m==0, the (i == m) test
compares m with uninitialized variable i.  It would seem logical to report this
first (the fact is, it is the root of the bug).

-- 
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/20170504/344c057f/attachment.html>


More information about the llvm-bugs mailing list