[LLVMbugs] [Bug 21111] New: Clang miscompiles dllimport + thread local variables

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 30 23:27:04 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=21111

            Bug ID: 21111
           Summary: Clang miscompiles dllimport + thread local variables
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david.majnemer at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

consider:
__declspec(thread, dllimport) int x;
int f() { return x; }

we generate:
"?f@@YAHXZ":                            # @"\01?f@@YAHXZ"
# BB#0:                                 # %entry
        pushl   %ebp
        movl    %esp, %ebp
        movl    __tls_index, %eax 
        movl    %fs:__tls_array, %ecx 
        movl    (%ecx,%eax,4), %eax
        movl    "?x@@3HA"@SECREL32(%eax), %eax
        popl    %ebp
        retl

Note that 'x' isn't dllimport'd

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141001/6cea9938/attachment.html>


More information about the llvm-bugs mailing list