[LLVMbugs] [Bug 19020] New: -Wunreachable-code should not complain about unreachable declarations.
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Mar 1 18:40:14 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=19020
Bug ID: 19020
Summary: -Wunreachable-code should not complain about
unreachable declarations.
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: scshunt at csclub.uwaterloo.ca
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Consider the following example:
scshunt at orolo:~$ clang -x c -Wunreachable-code -
void foo(int i) {
switch(i) {
int j;
case 1:
j = 4;
j *= 6;
default:
return;
}
}
<stdin>:3:5: warning: will never be executed [-Wunreachable-code]
int j;
^~~~~~
1 warning generated.
In this case, the fact that the declaration is never reached is not a problem,
because the declaration doesn't actually execute any code, and the compiler
still needs to ensure that when it jumps to the label, the stack pointer is
updated correctly.
If the variable is initialized, then the initializer will be skipped, and this
should perhaps be a separate warning, but that's a different issue.
--
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/20140302/d2aad53d/attachment.html>
More information about the llvm-bugs
mailing list