Thread overview |
---|
May 07, 2008 [Issue 2076] New: offset doesn't work in asm | ||||
---|---|---|---|---|
| ||||
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. -- |
June 24, 2008 [Issue 2076] asm: offset has wrong docs and error without line number | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | 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 ------- Comment #1 from clugdbug@yahoo.com.au 2008-06-24 08:06 ------- 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.) -- |
July 09, 2008 [Issue 2076] asm: offset has wrong docs and error without line number | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2076 clugdbug@yahoo.com.au changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #2 from clugdbug@yahoo.com.au 2008-07-09 07:15 ------- Fixed DMD1.032 -- |
July 10, 2008 [Issue 2076] asm: offset has wrong docs and error without line number | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2076 ------- Comment #3 from bugzilla@digitalmars.com 2008-07-09 22:42 ------- Fixed dmd 2.016 -- |
Copyright © 1999-2021 by the D Language Foundation