<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - x86 assembler immediates should be limited to 32 bit"
   href="https://bugs.llvm.org/show_bug.cgi?id=33654">33654</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>x86 assembler immediates should be limited to 32 bit
          </td>
        </tr>

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

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

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

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

        <tr>
          <th>Reporter</th>
          <td>dimitry@andric.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - LLVM ERROR: Error parsing inline asm"
   href="show_bug.cgi?id=33386">bug 33386</a>, Jonas Vekeman encountered a situation where OpenSSL's inline
assembly in combination with function inlining could sometimes lead to errors
from the inline asm parser, e.g.:

    <inline asm>:1:12: error: invalid operand for instruction
            divq      $-8446744073709551616
                      ^~~~~~~~~~~~~~~~~~~~~
    LLVM ERROR: Error parsing inline asm

For this particular case, I created a test.s file with just:

    divq 0x7fffffff
    divq 0x80000000
    divq 0xffffffff
    divq 0x100000000
    divq 0xffffffffffffffff

For this assembly, GNU as rightfully complains about lines 2 through 4:

    divtest.s: Assembler messages:
    divtest.s:2: Error: operand type mismatch for `div'
    divtest.s:3: Error: operand type mismatch for `div'
    divtest.s:4: Error: operand type mismatch for `div'

However, clang 5.0.0 doesn't complain at all, and produces an object file.
Disassembling it shows that clang has silently wrapped the too-large values:

       0:       48 f7 34 25 ff ff ff 7f         divq    2147483647
       8:       48 f7 34 25 00 00 00 80         divq    -2147483648
      10:       48 f7 34 25 ff ff ff ff         divq    -1
      18:       48 f7 34 25 00 00 00 00         divq    0
      20:       48 f7 34 25 ff ff ff ff         divq    -1

At the very least, it should complain here like GNU as does, IMHO.</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>