# HG changeset patch # User thomask # Date 1148487823 0 # Node ID adf31c7a5127026e816614ce96b41175865c9a7c # Parent 740c7e3dae39c4b35cacac5cb8e34f2f574ffbe2 Inline Assembler offset keyword 2006-04-28 news:bug-116-3@http.d.puremagic.com/bugzilla/ diff -r 740c7e3dae39 -r adf31c7a5127 nocompile/a/asm_offset_01_B.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nocompile/a/asm_offset_01_B.d Wed May 24 16:23:43 2006 +0000 @@ -0,0 +1,36 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ +// @date@ 2006-04-28 +// @uri@ news:bug-116-3@http.d.puremagic.com/bugzilla/ + +// __DSTRESS_ELINE__ 26 + +module dstress.nocompile.a.asm_offset_01_B; + +version(D_InlineAsm_X86){ + version = runTest; +}else version(D_InlineAsm_X86_64){ + version = runTest; +} + +version(runTest){ + byte b; + + void main(){ + + static if(size_t.sizeof == 4){ + asm{ + mov EAX, offsetof b; + } + }else{ + pragma(msg, "DSTRESS{ERROR}: unsupported pointer size"); + static assert(0); + } + } +}else{ + pragma(msg, "DSTRESS{XFAIL}: no inline ASM support"); + static assert(0); +} diff -r 740c7e3dae39 -r adf31c7a5127 run/a/asm_offset_01_A.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/a/asm_offset_01_A.d Wed May 24 16:23:43 2006 +0000 @@ -0,0 +1,43 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ +// @date@ 2006-04-28 +// @uri@ news:bug-116-3@http.d.puremagic.com/bugzilla/ + +module dstress.run.a.asm_offset_01_A; + +version(D_InlineAsm_X86){ + version = runTest; +}else version(D_InlineAsm_X86_64){ + version = runTest; +} + +version(runTest){ + byte b; + + int main(){ + void* x = &b; + void* y; + + static if(size_t.sizeof == 4){ + asm{ + mov EAX, offset b; + mov y, EAX; + } + }else{ + pragma(msg, "DSTRESS{ERROR}: unsupported pointer size"); + static assert(0); + } + + if(x != y){ + assert(0); + } + + return 0; + } +}else{ + pragma(msg, "DSTRESS{XFAIL}: no inline ASM support"); + static assert(0); +}