From dc9567a6e23c0066e5acdb94fbed4f7b66ce8299 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 21 Sep 2023 06:11:28 +0100 Subject: [PATCH] Fix clang warning Clang issues a warning about what we are really intending to do. Use an explicit type as argument to sizeof(). tracer.c:1152:28: warning: 'memcpy' call operates on objects of type 'const char' while the size is based on a different type 'const char *' [-Wsizeof-pointer-memaccess] memcpy(&ptr, ptr, sizeof(ptr)); ~~~ ^~~ tracer.c:1152:28: note: did you mean to provide an explicit length? memcpy(&ptr, ptr, sizeof(ptr)); ^~~ Signed-off-by: Mathieu Desnoyers --- src/tracer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tracer.c b/src/tracer.c index 1967e81..a0567cb 100644 --- a/src/tracer.c +++ b/src/tracer.c @@ -1149,7 +1149,7 @@ const char *tracer_gather_access(enum side_type_gather_access_mode access_mode, return ptr; case SIDE_TYPE_GATHER_ACCESS_POINTER: /* Dereference pointer */ - memcpy(&ptr, ptr, sizeof(ptr)); + memcpy(&ptr, ptr, sizeof(const char *)); return ptr; default: abort(); -- 2.34.1