[LLVMbugs] [Bug 24072] New: [x86 assembler] no error diagnostic for out-of-range jrcxz/jecxz/jcxz

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 8 16:43:31 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24072

            Bug ID: 24072
           Summary: [x86 assembler] no error diagnostic for out-of-range
                    jrcxz/jecxz/jcxz
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: charles_li at playstation.sony.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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:
/*******************************************************************/
> cat jecxz.s
    .balign 256
    jecxz   foo
    .balign 256
  foo:

> clang jecxz.s –c
  (no error)

> gcc jecxz.s -c
  jecxz.s: Assembler messages:
  jecxz.s:2: Error: value of 253 too large for field of 1 bytes at 2

/*******************************************************************/
> cat jrcxz.s
    .balign 256
    jrcxz   foo
    .balign 256
  foo:

> clang jrcxz.s -c -m64
  (no error)

> gcc jrcxz.s -c -m64
  jrcxz.s: Assembler messages:
  jrcxz.s:2: Error: value of 254 too large for field of 1 bytes at 1

/*******************************************************************/
> cat jcxz.s
    .balign 256
    jcxz    foo
    .balign 256
  foo:

> clang jcxz.s -c -m32
  (no error)

> gcc jcxz.s -c -m32
  jcxz.s: Assembler messages:
  jcxz.s:2: Error: value of 253 too large for field of 1 bytes at 2

/*******************************************************************/

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150708/7c93df6f/attachment.html>


More information about the llvm-bugs mailing list