<html>
    <head>
      <base href="https://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 --- - Casting result of side-effecting unary operation to union removes side effecting expression" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23597&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=jDY4yyUHkq7FN5eKk46NJdlhQgDXLcO4VTdI_O6IfxQ&s=nrwJTqOy7af-_BRYMXZa4F9YHZawmdxPWERnUdmaeAw&e=">23597</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Casting result of side-effecting unary operation to union removes side effecting expression
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>colin.gordon@samsung.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>Created <span class=""><a href="attachment.cgi?id=14350" name="attach_14350" title="Code to reproduce">attachment 14350</a> <a href="attachment.cgi?id=14350&action=edit" title="Code to reproduce">[details]</a></span>
Code to reproduce

Overview:
Casting the result of a side-effecting unary expression (e.g., ++) to a union
without using the cast's result removes the side effect.

Steps to reproduce:
1. Compile the attached file, with any optimization level.
2. Run resulting binary.


Actual results:
Prints 0.

Expected results:
Prints 10.

Build Date and Platform:
First observed on:
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

Additional Builds and Platforms:
Also observed on:
clang version 3.6.0 (tags/RELEASE_360/final)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

and:
Ubuntu clang version 3.5.0-4ubuntu2~trusty2 (tags/RELEASE_350/final) (based on
LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix</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>