[LLVMbugs] [Bug 13037] New: Thumb PLD instruction with positive immediate is treated as PLD with negative immediate.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 6 04:12:58 PDT 2012


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

             Bug #: 13037
           Summary: Thumb PLD instruction with positive immediate is
                    treated as PLD with negative immediate.
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: ARM
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: richard.barton at arm.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Thumb2 PLD immediate instructions are incorrectly handled by MC. The decoder
and encoder appear to confuse the T1 (positive offset) and T2 (negative offset)
encodings.

Reproduce with: echo 0x1f 0xf8 0x02 0xf0 |
/work/ricbar01/llvm-oss/build/bin/llvm-mc -triple thumbv7 -show-encoding
-disassemble -show-inst

        .section        __TEXT,__text,regular,pure_instructions
        pld     [pc, #-2]               @ encoding: [0x9f,0xf8,0x02,0xf0]
                                        @ <MCInst #2386 t2PLDi12
                                        @  <MCOperand Reg:43>
                                        @  <MCOperand Imm:-2>
                                        @  <MCOperand Imm:14>
                                        @  <MCOperand Reg:0>>

The reproducer shows that this is likely to be a bug in decode. The MC inst is
a t2PLDi12 which suggests that this instruction is decoded as the T1 encoding.
However the encoding has bit 3 of the top half word set, indicating that this
should be the T2 encoding. 

The disassembly seems correct, although this is more likely a coincidence of
the assembly representation of these instructions being identical. There is
possibly an argument for an assert to fail in the inst printer for the T1
encoding with a negative offset.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list