116 – Inline Assembler offset keyword

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 116 - Inline Assembler offset keyword
Summary: Inline Assembler offset keyword
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: Walter Bright
URL:
Keywords: accepts-invalid, diagnostic, wrong-code
Depends on:
Blocks:
Reported: 2006年04月27日 21:25 UTC by Alberto Simon
Modified: 2014年02月15日 02:14 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Alberto Simon 2006年04月27日 21:25:03 UTC
The compiler confuses offset keyword in the inline assembler with .offsetof property and issues a deprecated keyword error. This is easily reproduced by compiling the following:
CODE:
int[5] bar;
void foo()
{
 asm
 {
 mov ECX,offset bar;
 }
}
a workaround would be to do this:
int[5] bar;
void foo()
{
 void* pbar = &bar;
 asm
 {
 mov ECX,pbar;
 }
}
after issuing the error it says to use offsetof instead, and when you write:
int[5] bar;
void foo()
{
 asm
 {
 mov ECX,offsetof bar;
 }
}
it compiles and runs until a runtime error is issued.
Comment 1 Walter Bright 2006年06月20日 02:18:45 UTC
Fixed DMD 0.161 (there was a bug in the offsetof implementation, but still offsetof is preferred to offset)


AltStyle によって変換されたページ (->オリジナル) /