<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 --- - [x86 assembler] no error diagnostic for out-of-range jrcxz/jecxz/jcxz" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24072&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=H1fHg4b5rnP8m_DFsQaLV0J8R8Bk_1z6HooBzjQ4aEE&s=7QeaXFnTn0sNXJEcvO1zuV0eMkXGfLh9a8o-Z8uFi3w&e=">24072</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[x86 assembler] no error diagnostic for out-of-range jrcxz/jecxz/jcxz
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>charles_li@playstation.sony.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>X86 instructions jrcxz/jecxz/jcxz performs short jumps if rcx/ecx/cx register
is 0
The maximum relative offset for a forward short jump is 127 Bytes (0x7F).
The maximum relative offset for a backward short jump is 128 Bytes (0x80).

Gnu assembler warns when the distance of the jump exceeds the maximum but
llvm-as does not.

Here are 3 examples:
/*******************************************************************/
<span class="quote">> cat jecxz.s</span >
    .balign 256
    jecxz   foo
    .balign 256
  foo:

<span class="quote">> clang jecxz.s –c</span >
  (no error)

<span class="quote">> gcc jecxz.s -c</span >
  jecxz.s: Assembler messages:
  jecxz.s:2: Error: value of 253 too large for field of 1 bytes at 2

/*******************************************************************/
<span class="quote">> cat jrcxz.s</span >
    .balign 256
    jrcxz   foo
    .balign 256
  foo:

<span class="quote">> clang jrcxz.s -c -m64</span >
  (no error)

<span class="quote">> gcc jrcxz.s -c -m64</span >
  jrcxz.s: Assembler messages:
  jrcxz.s:2: Error: value of 254 too large for field of 1 bytes at 1

/*******************************************************************/
<span class="quote">> cat jcxz.s</span >
    .balign 256
    jcxz    foo
    .balign 256
  foo:

<span class="quote">> clang jcxz.s -c -m32</span >
  (no error)

<span class="quote">> gcc jcxz.s -c -m32</span >
  jcxz.s: Assembler messages:
  jcxz.s:2: Error: value of 253 too large for field of 1 bytes at 2

/*******************************************************************/</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>