Skip to content

Commit

Permalink
Don't sign extend 32 bit unsigned constants in iasm.
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterWaldron committed Apr 22, 2015
1 parent b21176c commit b0f890f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/iasm.c
Expand Up @@ -4422,12 +4422,17 @@ static OPND *asm_primary_exp()
break;

case TOKint32v:
case TOKuns32v:
o1 = new OPND();
o1->disp = (d_int32)asmtok->int64value;
asm_token();
break;

case TOKuns32v:
o1 = new OPND();
o1->disp = (d_uns32)asmtok->uns64value;
asm_token();
break;

case TOKint64v:
case TOKuns64v:
o1 = new OPND();
Expand Down
14 changes: 14 additions & 0 deletions test/runnable/iasm64.d
Expand Up @@ -6561,6 +6561,19 @@ L1: pop RAX;

/****************************************************/

void testconst()
{
ulong result;
asm
{
mov RAX, 0xFFFF_FFFFu;
mov result, RAX;
}
assert (result == 0xFFFF_FFFFu);
}

/****************************************************/

void test9965()
{
ubyte* p;
Expand Down Expand Up @@ -6721,6 +6734,7 @@ int main()
test9965();
test12849();
test12968();
testconst();

printf("Success\n");
return 0;
Expand Down

0 comments on commit b0f890f

Please sign in to comment.