This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Incorrect Thumb operand strange behaviour

Hello,

I am trying to compile some asm code with operand unable to be used as immediate, but compiler does not generate error but produce strange binary code, hard to detect erroneous code.

The source code

int main(void)
{

        asm volatile ( "mov r0, #0x1234 \n"
                              "orr r0, #0x4321 \n");
}

The binary code generated

0000802c <main>:
    802c:       f241 2034       movw    r0, #4660       ; 0x1234
    8030:       f244 3021       movw    r0, #17185      ; 0x4321
    8034:       2000               movs    r0, #0
    8036:       4770               bx      lr

Why does not the compiler throw warn or error but silently produce the strange code?

Thanks

Gene