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

missing warnings on case value overflow #4779

Closed
llvmbot opened this issue Jun 17, 2009 · 5 comments
Closed

missing warnings on case value overflow #4779

llvmbot opened this issue Jun 17, 2009 · 5 comments
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 17, 2009

Bugzilla Link 4407
Resolution FIXED
Resolved on Mar 12, 2010 00:57
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @lattner

Extended Description

  1. Clang should warn on a case value that exceeds the range of the type in switch.

int test1(const char foo) {
int success = 0;
switch(foo[0]) {
case 1234: /
XXX */
success = 1;
break;
default:
break;
}
return success;
}

  1. Clang should warn on switch(bool) since it's almost certainly wrong (developers seem okay with using if-statements instead).

int test2(const char foo) {
int success = 0;
switch (foo && foo[0]) { /
XXX */
case 0:
success = 1;
break;
case 1:
break;
}
return success;
}

@llvmbot
Copy link
Collaborator Author

llvmbot commented Oct 14, 2009

This report contains two separate issues. I created http://llvm.org/bugs/show_bug.cgi?id=5190 to track the second one. Let's track the first one only here.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Oct 14, 2009

Proposed patch uploaded to http://codereview.appspot.com/130078 for review.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Oct 16, 2009

Patch sent to cfe-commits for review.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Oct 16, 2009

Fixed in r84259.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Nov 27, 2021

mentioned in issue llvm/llvm-bugzilla-archive#5190

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
plotfi pushed a commit to plotfi/llvm-project that referenced this issue Jun 6, 2022
[5.7] Add `-index-ignore-pcms` to prevent indexing PCMs for imports/deps
This issue was closed.
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:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
Development

No branches or pull requests

1 participant