diff mbox series

[committed] libgomp: Use void (*) (void *) rather than void (*)() for host_fn type [PR114216]

Message ID ZeWnVIXsh4k7ifb2@tucnak
State New
Headers show
Series [committed] libgomp: Use void (*) (void *) rather than void (*)() for host_fn type [PR114216] | expand

Commit Message

Jakub Jelinek March 4, 2024, 10:49 a.m. UTC
Hi!

For the type of the target callbacks we use elsehwere void (*) (void *) and
IMHO should use that for the reverse offload fallback as well (where the actual
callback is emitted using the same code as for host fallback or device kernel
entry routines), even when it is also ok to use void (*) () before C23 and
we aren't building libgomp with C23 yet.  On some arches perhaps void (*) ()
could result in worse code generation because calls in that case like casts
to unprototyped functions need to sometimes pass argument in two different spots
etc. so that it deals with both passing it through ... and as a named argument.

Tested on x86_64-linux, committed to trunk.

2024-03-04  Jakub Jelinek  <jakub@redhat.com>

	PR libgomp/114216
	* target.c (gomp_target_rev): Change host_fn type and corresponding
	cast from void (*)() to void (*) (void *).


	Jakub
diff mbox series

Patch

--- libgomp/target.c.jj	2024-01-03 12:07:47.812094729 +0100
+++ libgomp/target.c	2024-03-04 11:26:05.745094586 +0100
@@ -3447,7 +3447,7 @@  gomp_target_rev (uint64_t fn_ptr, uint64
 
   if (n == NULL)
     gomp_fatal ("Cannot find reverse-offload function");
-  void (*host_fn)() = (void (*)()) n->k->host_start;
+  void (*host_fn) (void *) = (void (*) (void *)) n->k->host_start;
 
   if ((devicep->capabilities & GOMP_OFFLOAD_CAP_SHARED_MEM) || mapnum == 0)
     {