[llvm-bugs] [Bug 26889] New: clang doesn't warn about duplicated conditions

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 9 11:23:52 PST 2016


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

            Bug ID: 26889
           Summary: clang doesn't warn about duplicated conditions
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ahatanak at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

clang should warn that condition “a == 2” is duplicated in the following
if-else-if chain:

int g1;

void foo1(int a) {
  if (a == 2)
    g1 = 32;
  else if (a == 3)
    g1 += 23;
  else if (a == 2)
    g1 -= 123;
}

gcc6 added a command line option -Wduplicated-cond to catch this.

-- 
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/20160309/aaf6c5af/attachment.html>


More information about the llvm-bugs mailing list