diff mbox

[committed] libgomp: Use appropriate size for malloc in goacc_new_thread

Message ID d17e8ddb-806d-eebe-9e14-5506855c9381@redhat.com
State New
Headers show

Commit Message

Aldy Hernandez Oct. 27, 2016, 5:36 p.m. UTC
Last year I had queued this up for the gomp4.1 merge to mainline, and 
Jakub said if no one complained it would be OK (or so I recall :-/).

Either way, I believe it's an obvious change.

This is working because sizeof(gomp_thread) is larger than 
sizeof(goacc_thread), but the extra memory is unnecessary.  It's not 
like goacc_thread has any variable length data at the end.

Committed to trunk.
commit 0c93cf2e4a8fe72b682ceceb344a3e59b9da0a9b
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Thu Oct 27 10:27:59 2016 -0700

    	* oacc-init.c (goacc_new_thread): Use sizeof of the appropriate
    	size when allocating new thread.
diff mbox

Patch

diff --git a/libgomp/oacc-init.c b/libgomp/oacc-init.c
index f2325ad..83920b52 100644
--- a/libgomp/oacc-init.c
+++ b/libgomp/oacc-init.c
@@ -325,7 +325,7 @@  acc_shutdown_1 (acc_device_t d)
 static struct goacc_thread *
 goacc_new_thread (void)
 {
-  struct goacc_thread *thr = gomp_malloc (sizeof (struct gomp_thread));
+  struct goacc_thread *thr = gomp_malloc (sizeof (struct goacc_thread));
 
 #if defined HAVE_TLS || defined USE_EMUTLS
   goacc_tls_data = thr;