[llvm-bugs] [Bug 38955] New: ExprMutationAnalyzer is confused by uninstanciated template function?!

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 15 02:12:31 PDT 2018


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

            Bug ID: 38955
           Summary: ExprMutationAnalyzer is confused by uninstanciated
                    template function?!
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: lebedev.ri at gmail.com
                CC: llvm-bugs at lists.llvm.org

using a = int;
struct b {
  long c();
};
struct e {
  a d;
};
class g {
public:
  e f[4];
};
class j {
  b h;
  template <int> void m() {
    for (int i;; ++i) {
      unsigned d = frame.f[i].d, k = h.c();
      if (d)
        l(__PRETTY_FUNCTION__, i, k);
     // ^ there is no 'l' function/variable!?
    }
  }
  g frame;
};

error: variable is mutated in the loop body and loop iteration expression
[bugprone-loop-variable-mutations,-warnings-as-errors]
    for (int i;; ++i) {
             ^
note: loop in question
    for (int i;; ++i) {
    ^
note: mutation in loop body occurs here
        l(__PRETTY_FUNCTION__, i, k);
                               ^
note: mutation in loop iteration expression occurs here
    for (int i;; ++i) {
                   ^

-- 
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/20180915/5762d873/attachment-0001.html>


More information about the llvm-bugs mailing list