From 26e1a1c66f2c651a3b1b5e5b5a00e4275df2ee51 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 22 Jan 2020 17:42:45 +0100 Subject: [PATCH] re PR libgomp/93065 (libgomp: destructor missing to delete goacc_cleanup_key) PR libgomp/93065 * oacc-init.c (goacc_runtime_deinitialize): New function. --- libgomp/ChangeLog | 8 ++++++++ libgomp/oacc-init.c | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index da2b99fa933b..bcc1b0e71317 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,11 @@ +2020-01-22 Jakub Jelinek + + Backported from mainline + 2019-12-31 Ayush Mittal + + PR libgomp/93065 + * oacc-init.c (goacc_runtime_deinitialize): New function. + 2019-12-20 Jakub Jelinek Backported from mainline diff --git a/libgomp/oacc-init.c b/libgomp/oacc-init.c index f30cf2f81d8d..033fac463c6a 100644 --- a/libgomp/oacc-init.c +++ b/libgomp/oacc-init.c @@ -657,6 +657,15 @@ goacc_runtime_initialize (void) goacc_host_init (); } +static void __attribute__((destructor)) +goacc_runtime_deinitialize (void) +{ +#if !(defined HAVE_TLS || defined USE_EMUTLS) + pthread_key_delete (goacc_tls_key); +#endif + pthread_key_delete (goacc_cleanup_key); +} + /* Compiler helper functions */ attribute_hidden void -- 2.47.2