[llvm-bugs] [Bug 32720] New: -Wconsumed emits a false warning on a state change following a loop

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 20 05:06:45 PDT 2017


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

            Bug ID: 32720
           Summary: -Wconsumed emits a false warning on a state change
                    following a loop
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: mail+llvm at tzik.jp
                CC: llvm-bugs at lists.llvm.org

Here is a repro case. The consumed annotation analysis is affected by an
unrelated simple loop.

$ clang++ --version
clang version 5.0.0
$ cat >foo.cc <<EOF
struct __attribute__((consumable(unconsumed))) Foo {
  void consume() __attribute__((set_typestate(consumed))) {}
};

void bar(Foo foo) {
  for (int i = 0; i < 1; ++i) {}
  foo.consume();
}
EOF
$ clang++ -Wconsumed -c foo.cc
foo.cc:7:26: warning: state of variable 'foo' must match at the entry and exit
of loop [-Wconsumed]

-- 
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/20170420/2389527d/attachment.html>


More information about the llvm-bugs mailing list