Problem with asm and short
Ary Manzana
Ary_member at pathlink.com
Sun Jun 25 13:04:46 PDT 2006
I think this program:
----------------------------
import std.stdio;
void main() {
short* s = new short[3];
s[0] = 1;
s[1] = 2;
s[2] = 3;
int a = 0;
asm {
mov EAX, s;
mov ECX, [EAX];
mov a, ECX;
}
writefln("%s", a);
}
----------------------------
should output 1, but it outputs 131073 (garbage). However, if instead of [EAX]
you write [EAX + 4] it outputs 3 (and with [EAX + 2] garbage again). Am I doing
something wrong or this is a bug?
If the array is of ints, the programs works OK.
More information about the Digitalmars-d-bugs
mailing list