This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix a bug in emutls
- From: Jie Zhang <jie dot zhang at analog dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 13 Feb 2009 18:04:36 +0800
- Subject: Fix a bug in emutls
The number of the elements of data[] in struct __emutls_array is (size -
1), not size. I found this when I was looking at several FAILs in
libgomp testsuite for Blackfin, which uses emutls to emulate TLS. This
patch fixes it. OK?
Jie
* emutls.c (emutls_destroy): Don't fall out of the array bound.
Index: emutls.c
===================================================================
--- emutls.c (revision 144149)
+++ emutls.c (working copy)
@@ -73,7 +73,7 @@ emutls_destroy (void *ptr)
pointer size = arr->size;
pointer i;
- for (i = 0; i < size; ++i)
+ for (i = 0; i < size - 1; ++i)
{
if (arr->data[i])
free (arr->data[i][-1]);