[Bug libgomp/93065] New: libgomp: destructor missing to delete goacc_cleanup_key

2019-12-24 Thread v.narang at samsung dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93065

Bug ID: 93065
   Summary: libgomp: destructor missing to delete
goacc_cleanup_key
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libgomp
  Assignee: unassigned at gcc dot gnu.org
  Reporter: v.narang at samsung dot com
CC: jakub at gcc dot gnu.org
  Target Milestone: ---

libgomp constructor creates goacc_cleanup_key on dlopen but doesn't delete key
on dlclose. dlopen and dlclose of libgomp.so exhausts pthread keys, which
results in pthread_key_create failure.

pthread_key_delete needs to be called by libgomp destructor.

Test Code:

#include 
#include 
#include 

int main(int argc, char **argv)
{
void *handle;
double (*cosine)(double);
char *error;

while(1) {
handle = dlopen("/usr/lib/libgomp.so", RTLD_LAZY);
if (!handle) {
fprintf(stderr, "%s\n", dlerror());
exit(EXIT_FAILURE);
}

dlclose(handle);

}
exit(EXIT_SUCCESS);
}


Test Logs:
$./a.out
libgomp: could not create thread pool destructor

[Bug libgomp/93065] libgomp: destructor missing to delete goacc_cleanup_key

2019-12-25 Thread v.narang at samsung dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93065

--- Comment #1 from Vaneet Narang  ---
Bugfix patch shared:
https://gcc.gnu.org/ml/gcc-bugs/2019-12/msg02132.html