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: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Consider the following example:
scshunt@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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs