This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/26461] New: liveness of thread local references across function calls
- From: "yichen dot xie at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Feb 2006 20:51:56 -0000
- Subject: [Bug c/26461] New: liveness of thread local references across function calls
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I ran into this problem with stock gcc-4.0.2 on Fedora Core 2. The problem
shows when the following code is compiled with -O2: the address of "array"
seems to be cached and reused across calls to function "h". This becomes a
problem when function h saves its execution context in one thread and resumes
in another thread (thus the address of array changes before and after the
call). Is this a feature or a bug? How could I instruct gcc not to reuse thread
local addresses acrosses function calls? Thanks.
__thread int array[1];
int *f()
{
for (;;)
h(array);
return array;
}
--
Summary: liveness of thread local references across function
calls
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: yichen dot xie at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26461