[llvm-bugs] [Bug 38957] New: ExprMutationAnalyzer issue with vararg

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 15 03:06:50 PDT 2018


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

            Bug ID: 38957
           Summary: ExprMutationAnalyzer issue with vararg
           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

I think this example is incorrect and is a duplicate of
https://bugs.llvm.org/show_bug.cgi?id=38955, but this is the best i can do
right now. Can't write better interestingness test for creduce.

void c(char *f, ...);
void c(char *f, ...) {
  __builtin_va_list e;
  __builtin_va_start(e, f);
  __builtin_va_end(e);
}

template <int> void o() {
  for (int i;; ++i) {
    c(__PRETTY_FUNCTION__, i);
  }
}

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
    c(__PRETTY_FUNCTION__, i);
                           ^
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/436d9a18/attachment.html>


More information about the llvm-bugs mailing list