digitalmars.D.bugs - [Issue 2076] New: offset doesn't work in asm
- d-bugmail puremagic.com (38/38) May 07 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2076
- d-bugmail puremagic.com (18/18) Jun 24 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2076
- d-bugmail puremagic.com (9/9) Jul 09 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2076
- d-bugmail puremagic.com (4/4) Jul 09 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2076
http://d.puremagic.com/issues/show_bug.cgi?id=2076 Summary: offset doesn't work in asm Product: D Version: 1.028 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: clugdbug yahoo.com.au I wanted to get the address of a label into a register. This seems to be impossible at present. I tried various things, including the code below, which prints: ----- Error: offset deprecated, use offsetof which (a) gives no line number; and (b) in the spec, 'offset' is permitted in asm (and offsetof is not mentioned). ----- void main() { asm { mov EAX, offset L1; L1: ; } } Finally, bug(c): mov EAX, $; doesn't work either. It seems that $ only works in jmp instructions? This is either a compiler bug, or should be mentioned in the spec. So it seems that there is no way to get the current address into a register. This limitation means that there's no way to (efficiently) implement duff's device in asm. But it's probably a side-effect of there being no way to take the address of a label in normal D code. --
May 07 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2076 clugdbug yahoo.com.au changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|offset doesn't work in asm |asm: offset has wrong docs | |and error without line | |number The inability to get the address of a label is the same bug as 1829. Changing this to be a documentation bug: * spec mentions offset, should be offsetof. * spec mentions seg, which doesn't seem to work (and has no purpose in any 32-bit OS which I know of) * spec should state that $ only works in jump instructions. Also has an error without line number. (Note that it would also be possible to remove the 'offset deprecated' message entirely. It's been years since it was valid.) --
Jun 24 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2076 clugdbug yahoo.com.au changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed DMD1.032 --
Jul 09 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2076 Fixed dmd 2.016 --
Jul 09 2008