According to Peter Gerwinski peter@agnes.dida.physik.uni-essen.de:
According to PredatorZeta:
I receive the same invalid 386 instruction error message. Mmmh...I investigate on this. I have found this (probably) bug in the "as":
movl $_TheArray(,%%esi,4), %%eax
and
movl %%eax, _TheArray(,%%esi,4)
is accepted from the assembler without any problems. But sadly:
movl %%eax, $_TheArray(,%%esi,4)
is refused. If this isn't a bug, anyone know the reasons?
I do not really know, but I guess that it's the following: The `$' denotes a constant value, something without a `$' denotes a memory reference.
Not exatly, because $_TheArray is however an immediate value (displacement). The "AS" might accept this, because $_TheArray can be managed really as an immediate. Besides, logically if "movl $_TheArray(,%%esi,4), %%eax" is OK, movl %%eax, $_TheArray(,%%esi,4) MUST be OK.
But if it is so, I have problems to imagine what "movl $_TheArray(,%%esi,4), %%eax" means ... except if the `movl' is silently translated to a `leal'. Could please somebody check it out?
Here you are Peter! I have disassembled the object file outputted by "AS".
"movl $_TheArray(,%%esi,4), %%eax" is showed in Intelly way as
"mov eax, DWORD PTR [esi*4+_TheArray]"
without any lea. More probably is an "AS" parsing problem. If it found an $ at the beginning of the DEST operand, it assume that you tried to move something in an immediate value, and emit the error message. But it isn't necessary an invalid opcode!!!!
Cya. PrZ.