D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2455 - Cannot use .ptr or .length in asm code
Summary: Cannot use .ptr or .length in asm code
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 major
Assignee: No Owner
URL:
Keywords: iasm, rejects-valid
Depends on:
Blocks:
 
Reported: 2008-11-14 23:02 UTC by Don
Modified: 2020-03-21 03:56 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Don 2008-11-14 23:02:03 UTC
This was first reported in #1125 as failed workaround. I'm moving it here since the original bug in #1125 was fixed long ago.
It's in dstress as:

http://dstress.kuehne.cn/run/t/tuple_23_C.d

It's probably related to #1252, #1172, and #1173. It seems that fullstops ('.') are not treated correctly. #1500 may also be related.

void foo(int [] q)
{
  asm{
	mov EAX, q.ptr;
//        mov ECX, q.length; // this doesn't work either
   }
}

There aren't any good workarounds for this. Creating a local variable and using 'naked' are the two best options, but they're both ugly.
Comment 1 basile-z 2019-07-23 01:52:23 UTC
D expressions allowed as asm operands must give either directly a variable or must evaliate to a constant known at compile time (limited to type property for now). .length / .ptr is already more complex and requires an offset.