This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/77285] New: extern thread_local linkage
- From: "jan.willem.ps at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 18 Aug 2016 07:25:10 +0000
- Subject: [Bug c++/77285] New: extern thread_local linkage
- Authentication-results: sourceware.org; auth=none
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77285
Bug ID: 77285
Summary: extern thread_local linkage
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jan.willem.ps at gmail dot com
Target Milestone: ---
Minimal test case:
cat > a.h <<EOF
#pragma once
#include <string>
extern thread_local std::string gFeelingLucky;
EOF
cat > a.cpp <<EOF
#include "a.h"
thread_local std::string gFeelingLucky = "Lucky";
EOF
cat > main.cpp <<EOF
#include "a.h"
#include <iostream>
int main() {
std::cout << "I'm feeling " << gFeelingLucky << '\n';
}
EOF
c++ -std=c++11 main.cpp a.cpp -o main
Output:
/tmp/cc1AJnUy.o: In function `_ZTW13gFeelingLucky':
main.cpp:(.text._ZTW13gFeelingLucky[_ZTW13gFeelingLucky]+0x5): undefined
reference to `_ZTH13gFeelingLucky'
collect2: error: ld returned 1 exit status
I've used the docker images on dockerhub to verify:
docker run -it --rm gcc:5.1 bash
This does work on gcc 4.9.0 (docker run --rm -it gcc:4.9.0 bash), so it looks
like a regression (see bug #55800).
It also doesn't work with gcc 6.1 (docker run -it --rm gcc:6.1 bash).