diff options
author | danglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-12-11 18:33:48 +0000 |
---|---|---|
committer | danglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-12-11 18:33:48 +0000 |
commit | 53e0412afceaac051f3e38a2c0f1060b7e9e915a (patch) | |
tree | 73ec3d55aba0ac032325b5b94a87b6a203d3327c /gcc/emutls.c | |
parent | 03c0a4937ec24a40c9bd34172579be84f8b9b671 (diff) | |
download | gcc-53e0412afceaac051f3e38a2c0f1060b7e9e915a.tar.gz |
PR testsuite/35677
* emutls.c (__emutls_get_address): Make sure offset is really zero
before initializing the object's offset.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142687 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/emutls.c')
-rw-r--r-- | gcc/emutls.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/emutls.c b/gcc/emutls.c index fc008952979..32e14a1c97e 100644 --- a/gcc/emutls.c +++ b/gcc/emutls.c @@ -147,8 +147,12 @@ __emutls_get_address (struct __emutls_object *obj) static __gthread_once_t once = __GTHREAD_ONCE_INIT; __gthread_once (&once, emutls_init); __gthread_mutex_lock (&emutls_mutex); - offset = ++emutls_size; - obj->loc.offset = offset; + offset = obj->loc.offset; + if (offset == 0) + { + offset = ++emutls_size; + obj->loc.offset = offset; + } __gthread_mutex_unlock (&emutls_mutex); } |