[LLVMbugs] [Bug 19989] New: Change introduced in r207451 broke thread_local on Darwin

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 10 00:41:57 PDT 2014


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

            Bug ID: 19989
           Summary: Change introduced in r207451 broke thread_local on
                    Darwin
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: oneill+llvmbugs at cs.hmc.edu
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

In r207451, majnemer moved code related to thread_local on Darwin (originally
written by void in r180941) out of CodeGenModule.cpp and into ASTContext.cpp,
in doing so, it changed the meaning of the code, from controlling the
visibility of the _backing store_ for a thread local variable to making the
entire variable static.

Obviously, this breaks things.

Test case:

Place the following line in defn.cpp

thread_local int perThread;

With a version of clang before this change (I happen to have 199067), we see 

darwin% ~/llvm.199067/bin/clang++ -std=c++11 -stdlib=libc++ -c defn.cpp
darwin% nm -m defn.o
0000000000000048 (__TEXT,__eh_frame) non-external EH_frame0
0000000000000000 (__TEXT,__text) private external __ZTW9perThread
0000000000000060 (__TEXT,__eh_frame) private external __ZTW9perThread.eh
                 (undefined) external __tlv_bootstrap
000000000000000f (__DATA,__thread_vars) non-external _perThread
0000000000000088 (__DATA,__thread_bss) non-external _perThread$tlv$init

In contrast, if we run the current head, we see this

darwin% ~/llvm.210506/bin/clang++ -std=c++11 -stdlib=libc++ -c defn.cpp
darwin% nm -m defn.o
warning:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm:
no name list

Oops, it threw everything away because it thought it was an unused static
variable!

-- 
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/20140610/2e836ee7/attachment.html>


More information about the llvm-bugs mailing list