[Issue 21186] New: Inline Assembler: static (thread-local) variables cannot be used
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sat Aug 22 00:16:00 UTC 2020
    
    
  
https://issues.dlang.org/show_bug.cgi?id=21186
          Issue ID: 21186
           Summary: Inline Assembler: static (thread-local) variables
                    cannot be used
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com
Moved from https://issues.dlang.org/show_bug.cgi?id=5922
bearophile_hugs at eml.cc writes:
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.
--
    
    
More information about the Digitalmars-d-bugs
mailing list