<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 --- - Incorrect code generated with unusual bitvector sizes"
   href="https://llvm.org/bugs/show_bug.cgi?id=27546">27546</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect code generated with unusual bitvector sizes
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nitpicker2000@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16277" name="attach_16277" title="Bug test case">attachment 16277</a> <a href="attachment.cgi?id=16277&action=edit" title="Bug test case">[details]</a></span>
Bug test case

The attached LLVM assembly file demonstrates the bug.  Certain code sequences
involving unusual bitvector sizes (i65, in particular) seem to generate
incorrect code.

In the attached file, the procedure @bug_proc performs some bit-manipulations
on its argument, which is supposed to result in the temporary %t5 containing
the original value zero extended to i65.  This value is negated and returned. 
The procedure @correct_proc does a zero extend directly and then negates and
returns.  I claim both procedures should be semantically identical, which
should result in the main function always returning a 0 exit code.  However,
this is not the case.  For some arguments, and at some optimization levels,
these procedures differ and the program returns exit code -1.  As best I can
tell, the attached program should not exhibit undefined behavior.

```
$ clang --version
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
$ clang -O0 -o bug bug.ll; ./bug; echo $?
255
$ clang -O1 -o bug bug.ll; ./bug; echo $?
255
$ clang -O2 -o bug bug.ll; ./bug; echo $?
0
$ clang -O3 -o bug bug.ll; ./bug; echo $?
0
$ clang -Os -o bug bug.ll; ./bug; echo $?
0
```

I get identical behavior from clang version 3.6.2 and clang 3.8.0 (installed
via Homebrew).</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>