Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang should warn when one condition trivially subsumes another condition #30245

Open
chandlerc opened this issue Nov 3, 2016 · 1 comment
Open
Labels
bugzilla Issues migrated from bugzilla clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer

Comments

@chandlerc
Copy link
Member

Bugzilla Link 30897
Version unspecified
OS All

Extended Description

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.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@Quuxplusone Quuxplusone added clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer and removed clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jan 17, 2022
@Quuxplusone
Copy link
Contributor

Note this is a generalization of #10324.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Projects
None yet
Development

No branches or pull requests

2 participants