Mercurial > projects > ldc
view tests/mini/asm6.d @ 1185:8baf611f0009
Fix nested references to 'ref' foreach variables.
These "walk around" the array being iterated over, so they're a bit trickier
than other variables to get right.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Wed, 01 Apr 2009 00:01:44 +0200 |
parents | 4c524d80e6e1 |
children | 08f87d8cd101 |
line wrap: on
line source
extern(C) int printf(char*, ...); void main() { int a,b,c; a = int.max-1; b = 5; version (D_InlineAsm_X86) { asm { mov EAX, a; mov ECX, b; add EAX, ECX; jo Loverflow; mov c, EAX; } } else version (D_InlineAsm_X86_64) { asm { movq RDX, a; movq RAX, b; add RDX, RAX; jo Loverflow; movq c, RDX; } } printf("a == %d\n", a); printf("b == %d\n", b); printf("c == %d\n", c); assert(c == c); return; Loverflow: int y=0; //assert(0, "overflow"); }