[llvm-bugs] [Bug 30897] New: Clang should warn when one condition trivially subsumes another condition

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


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

            Bug ID: 30897
           Summary: Clang should warn when one condition trivially
                    subsumes another condition
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chandlerc at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Consider this test code:

bool f(int x) {
  return x == 42 || x != 13;
}

bool g(int x) {
  return x == 42 || x > 13;
}

Both of these contain trivially subsumed cases in an ||. I think Clang should
be able to at least warn on these in ||s and &&s when the expressions are
integral type comparisons that we can easily analyze.

-- 
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/934dd263/attachment.html>


More information about the llvm-bugs mailing list