Fix clang warning
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 21 Sep 2023 05:11:28 +0000 (06:11 +0100)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 21 Sep 2023 05:11:28 +0000 (06:11 +0100)
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 <mathieu.desnoyers@efficios.com>
src/tracer.c

index 1967e81b1cbc0bc846e5d7ef2e636ab5c8873c21..a0567cb5b24fb5d2920ad3ec111be1da2594d7c8 100644 (file)
@@ -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();
This page took 0.02539 seconds and 4 git commands to generate.