[PATCH] D49763: [CUDA] Call atexit() for CUDA destructor early on.

Justin Lebar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 24 15:36:29 PDT 2018


jlebar accepted this revision.
jlebar added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/CodeGen/CGCUDANV.cpp:379
+  // Create destructor and register it with atexit() the way NVCC does it. Doing
+  // it during regular destructor phase worked in CUDA before 9.2 but results in
+  // double-free in 9.2.
----------------
the regular destructor phase


================
Comment at: clang/lib/CodeGen/CGCUDANV.cpp:380
+  // it during regular destructor phase worked in CUDA before 9.2 but results in
+  // double-free in 9.2.
+  if (llvm::Function *CleanupFn = makeModuleDtorFunction()) {
----------------
a double-free


https://reviews.llvm.org/D49763





More information about the cfe-commits mailing list