[LLVMbugs] [Bug 20359] New: ARM MC assembler allows backward branching on CBNZ instruction.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 18 10:20:12 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20359

            Bug ID: 20359
           Summary: ARM MC assembler allows backward branching on CBNZ
                    instruction.
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: sgundapa at codeaurora.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12791
  --> http://llvm.org/bugs/attachment.cgi?id=12791&action=edit
Test case to demonstrate the issue

I have attached an arm assembly file which can demonstrate the issue.
(The test case is an excerpt from compiler-rt ARM builtins library)

$ clang  -mcpu=cortex-a9 -c /tmp/temp.s -no-integrated-as -o /tmp/temp.o
/tmp/temp.s: Assembler messages:
/tmp/temp.s:13: Error: branch out of range
clang-3.5: error: assembler command failed with exit code 1 (use -v to see
invocation)

$ clang  -mcpu=cortex-a9 -c /tmp/temp.s -integrated-as -o /tmp/temp.o
The integrated-as compiles the file with out an issue and generates bad
assembly

$ arm-none-linux-gnueabi-objdump -S /tmp/temp.o
/tmp/temp.o:     file format elf32-littlearm
Disassembly of section .text:
00000000 <__sync_fetch_and_add_8>:
   0:    b570          push    {r4, r5, r6, lr}
   2:    f3bf 8f5f     dmb    sy
   6:    4684          mov    ip, r0
   8:    e8dc 017f     ldrexd    r0, r1, [ip]
   c:    1884          adds    r4, r0, r2
   e:    eb41 0503     adc.w    r5, r1, r3
  12:    e8cc 4576     strexd    r6, r4, r5, [ip]
  16:    bbbe          cbnz    r6, 88 <__sync_fetch_and_add_8+0x88>
  18:    f3bf 8f5f     dmb    sy
  1c:    bd70          pop    {r4, r5, r6, pc}


There is no address corresponding to 88 <__sync_fetch_and_add_8+0x88>.

The ARM manual on CBNZ says backward branching is not possible.
Refer to
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489c/Cjaghefc.html

-- 
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/20140718/6c1ba025/attachment.html>


More information about the llvm-bugs mailing list