NO

Author Topic: [asm] Invalid combination of opcode and operands (32bits version)  (Read 3566 times)

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2097
Compiling the following snippet with whichever optimization on you get the error.
Is'nt possible to see which opcode/operand the compiler is trying to use (is there a way to force compiler to emit only assembler ?), but I suspect that it want use an addressing mode valid only for  64bits.
Code: [Select]
#include <Windows.h>
#include <stdio.h>

typedef struct
{
int a;
int b;
POINTS pts;
} OBJ;

OBJ Obj, *lpObj;

POINTS func1(OBJ *lpObj, LPPOINTS p)
{
return (POINTS){1,2};
}

DWORD func2(OBJ *lpObj, DWORD a, DWORD b)
{
return a;
}

DWORD func3(OBJ *lpObj, DWORD a)
{
return a;
}

void ffunc(OBJ *lpObj, LPARAM lParam)
{
POINTS pt1 = func1(lpObj, &lpObj->pts);
POINTS pt2 = func1(lpObj, &MAKEPOINTS(lParam));

/*** On the following line we have:
error #3114: [asm] Invalid combination of opcode and operands.
***/
if (abs(pt1.x - (pt2.x)) < 10)
goto Error;

func2 (lpObj, func3(lpObj, min(pt1.x, pt2.x) - lpObj->b),
func3(lpObj, max(pt1.x, pt2.x) - lpObj->b));
Error:
lpObj->b = FALSE;
}
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

czerny

  • Guest
Re: [asm] Invalid combination of opcode and operands (32bits version)
« Reply #1 on: August 29, 2014, 05:50:27 PM »
(is there a way to force compiler to emit only assembler ?)

/Tx86-asm

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2097
Re: [asm] Invalid combination of opcode and operands (32bits version)
« Reply #2 on: August 29, 2014, 06:53:46 PM »
Yes Czerny, I'm really getting old!  ;D
I got it, the offending instructions are:
Code: [Select]
movsx edi,edi
movsx esi,eax
The movsx (move with sign extension) instructions don't support two 32 bits register, and it would not have made any sense to extend in the same format with sign extension ...  >:(
This is a compiler bug. And it is also very annoying, it's impossible to compile something that want sign extend a structure of two shorts...  >:(
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide