Gcc inline - operand type mismatch for 'cmp'

I am getting the following error:

Assembly messages:
Error: Mismatch of operand type for `cmp '

The only cmp in my code:

"cmpl %eax, $15\n\t"

      

I don't understand what's wrong with that: I have a register and an immediate value that needs to be implicitly expanded to 32 bits.

+3


source to share


1 answer


i had the same problem but in my case the error was with

cmp $0xFFFFFFFFFFFFFFFF, %rdx

      

and the decision was to do

movq $0xFFFFFFFFFFFFFFFF, %rcx

      



first and then

cmp %rcx, %rdx

      

(afaik, big cmp numbers need two registers, not const and register)

0


source







All Articles