This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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]);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]