<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 --- - detect null dereference in rvalue"
   href="http://llvm.org/bugs/show_bug.cgi?id=16356">16356</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>detect null dereference in rvalue
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nlewycky@google.com
          </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>Awesome:

$ echo 'void f() { *((char*)(0)) = 0; }' | clang -x c++ -
<stdin>:1:12: warning: indirection of non-volatile null pointer will be
deleted,
      not trap [-Wnull-dereference]
void f() { *((char*)(0)) = 0; }
           ^~~~~~~~~~~~~
<stdin>:1:12: note: consider using __builtin_trap() or qualifying pointer with
      'volatile'

Not as awesome:

$ echo 'void f() { *((char*)(0)); }' | clang -x c++ -
<stdin>:1:12: warning: expression result unused [-Wunused-value]
void f() { *((char*)(0)); }
           ^~~~~~~~~~~~~
1 warning generated.

We point out that something's wrong here, but a user who writes this isn't
going to understand that it means "we will not trap here". Saying "expression
discarded" instead of "expression result unused" would probably be enough to
coax the user into writing the code which generates the first diagnostic.

(See also related <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - missed null dereference warning"
   href="show_bug.cgi?id=11876">bug 11876</a>, if we were more aggressive about this, it would
probably catch that case too.)</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>