https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84629

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
I'm curious about:

/home/marxin/Programming/gcc/libsanitizer/sanitizer_common/sanitizer_linux.cc:
In function ‘void* __sanitizer::internal_start_thread(void (*)(void*), void*)’:
/home/marxin/Programming/gcc/libsanitizer/sanitizer_common/sanitizer_linux.cc:1733:58:
warning: cast between incompatible function types from ‘void (*)(void*)’ to
‘void* (*)(void*)’ [-Wcast-function-type]
 1733 |   real_pthread_create(&th, nullptr, (void*(*)(void *arg))func, arg);
      |                                                          ^~~~


Shouldn't something like:

diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc
b/libsanitizer/sanitizer_common/sanitizer_linux.cc
index f1f70ec57fc..7571ff9b25d 100644
--- a/libsanitizer/sanitizer_common/sanitizer_linux.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc
@@ -1719,7 +1719,7 @@ HandleSignalMode GetHandleSignalMode(int signum) {
 }

 #if !SANITIZER_GO
-void *internal_start_thread(void(*func)(void *arg), void *arg) {
+void *internal_start_thread(void*(*func)(void *arg), void *arg) {
   // Start the thread with signals blocked, otherwise it can steal user
signals.
   __sanitizer_sigset_t set, old;
   internal_sigfillset(&set);
@@ -1730,7 +1730,7 @@ void *internal_start_thread(void(*func)(void *arg), void
*arg) {
 #endif
   internal_sigprocmask(SIG_SETMASK, &set, &old);
   void *th;
-  real_pthread_create(&th, nullptr, (void*(*)(void *arg))func, arg);
+  real_pthread_create(&th, nullptr, func, arg);
   internal_sigprocmask(SIG_SETMASK, &old, nullptr);
   return th;
 }
@@ -1739,7 +1739,7 @@ void internal_join_thread(void *th) {
   real_pthread_join(th, nullptr);
 }
 #else
-void *internal_start_thread(void (*func)(void *), void *arg) { return 0; }
+void *internal_start_thread(void *(*func)(void *), void *arg) { return 0; }

 void internal_join_thread(void *th) {}
 #endif

by applied to libsanitizer mainline?

Reply via email to