This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/28141] thread-local ptr initialized to address of thread-local misclassified as non-constant initializer
- From: "gary at intrepid dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Jun 2006 16:44:31 -0000
- Subject: [Bug c/28141] thread-local ptr initialized to address of thread-local misclassified as non-constant initializer
- References: <bug-28141-9975@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from gary at intrepid dot com 2006-06-23 16:44 -------
I agree this is definitely an enhancement, but will note the following:
1. On Fedora Core 5, x86_64, I was able to successfully link and run
a null program (written in assembly) that initializes thread local
'ptr' that points to thread local 'data'. The declarations appear
as follows:
.globl data
.section .tbss,"awT",@nobits
.align 8
.type data, @object
.size data, 8
data:
.zero 8
.globl ptr
.align 8
.type ptr, @object
.size ptr, 8
ptr:
.quad data
I didn't run extensive tests to verify this was doing the right thing, but
there were no complaints from the linker.
2. Given that __thread is an extension, we could choose to interpret
"constancy", as "constant from the perspective of the currently executing
thread" without doing much harm to "C" semantics.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28141