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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to