[Bug middle-end/54129] emulated __thread variables and pthread_*specific data
blucia at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Jul 30 20:26:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54129
--- Comment #2 from blucia at gmail dot com 2012-07-30 20:25:52 UTC ---
The man page for pthread_key_create says:
"An optional destructor function may be associated with each key value. ...
The order of destructor calls is unspecified if more than one destructor exists
for a thread when it exits."
That's fine, but I did not register any destructor function for the __thread
variables that are getting zeroed! In my program, only one destructor function
exists.
It seems a little weird that those __thread variables are being zeroed at all.
Again, I'm not sure what the spec says, but it seems like a better default
behavior would be to let them retain their values until termination, unless
explicitly altered elsewhere. Doubly so, because it already does that on
Linux, and copying that behavior makes code more portable.
More information about the Gcc-bugs
mailing list