<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - -Wunreachable-code should not complain about unreachable declarations."
   href="http://llvm.org/bugs/show_bug.cgi?id=19020">19020</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-Wunreachable-code should not complain about unreachable declarations.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>scshunt@csclub.uwaterloo.ca
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>