[llvm-bugs] [Bug 30899] New: clang should warn on redundant assignments / obviously dead stores

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 3 10:51:41 PDT 2016


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

            Bug ID: 30899
           Summary: clang should warn on redundant assignments / obviously
                    dead stores
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvm-bugs at justinbogner.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

clang doesn't seem to warn on repeated assignments. That is, the following
produces no warning that the "i = 7" assignment has no effect. This kind of
obvious dead store should be possible to catch in a compiler warning.

  void foo(int);

  int main(int argc, const char *argv[]) {
    int i = 7;
    i = 8;
    foo(i);
    return 0;
  }

-- 
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/20161103/9eac571b/attachment.html>


More information about the llvm-bugs mailing list