[llvm-bugs] [Bug 47424] New: false-positive [clang-analyzer-deadcode.DeadStores] with reference

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Sep 4 13:22:08 PDT 2020


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

            Bug ID: 47424
           Summary: false-positive [clang-analyzer-deadcode.DeadStores]
                    with reference
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: tiagomacarios at gmail.com
                CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org

With the following code [clang-analyzer-deadcode.DeadStores] will report
'b=true' as never read, but ~S() will read it. 

https://godbolt.org/z/dqfrc1

#include <iostream>

struct S {
  const bool& m_b;
  S(bool const& b) : m_b(b) {}
  ~S() { std::cout << m_b; }
};

int main() {
  bool b = false;
  S s(b);
  b = true;
}

-- 
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/20200904/24a5cfbd/attachment.html>


More information about the llvm-bugs mailing list