[Issue 5922] New: immutable and static variables usage in asm{}
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue May 3 03:08:32 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5922
Summary: immutable and static variables usage in asm{}
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2011-05-03 03:04:41 PDT ---
I am not sure about the errors shown here (so no keywords). Please close this
bug report if things here are working as expected.
D2 code:
void main() {
immutable size_t x = 10;
asm {
mov EDI, x;
}
}
DMD 2.052 shows the error:
test.d(2): Error: Integer constant expression expected instead of x = 10u
--------------------------
D2 code, static (thread-local) variables can't be used in ASM:
void main() {
static size_t x = 10;
asm {
mov EDI, x;
}
}
It produces:
object.Error: Access Violation
They work using __gshared, this gives no errors:
void main() {
__gshared static size_t x = 10;
asm {
mov EDI, x;
}
}
My suggestion is to remove this source of errors. One solution may be to
disallow the direct access to static variables from asm code, avoiding this
bug.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list