From: Michael Jeanson Date: Tue, 18 Jan 2022 19:14:33 +0000 (+0000) Subject: Fix: may be used uninitialized on powerpc X-Git-Tag: v2.13.2~9 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=a4b5af217b22f855342570ce11ddeea41661fd5d;p=lttng-ust.git Fix: may be used uninitialized on powerpc Fix the following warning on powerpc : In file included from ../../src/common/counter/counter-internal.h:16, from ../../src/common/counter/counter-api.h:16, from counter-clients/percpu-64-modular.c:12: In function ‘__lttng_counter_add_percpu’, inlined from ‘lttng_counter_add’ at ../../src/common/counter/counter-api.h:265:10, inlined from ‘counter_add’ at counter-clients/percpu-64-modular.c:53:9: include/urcu/compiler.h:25:42: warning: ‘move_sum’ may be used uninitialized [-Wmaybe-uninitialized] 25 | #define caa_unlikely(x) __builtin_expect(!!(x), 0) | ^~~~~ ../../src/common/counter/counter-api.h:244:13: note: in expansion of macro ‘caa_unlikely’ 244 | if (caa_unlikely(move_sum)) | ^~~~~~~~~~~~ In file included from counter-clients/percpu-64-modular.c:12: counter-clients/percpu-64-modular.c: In function ‘counter_add’: ../../src/common/counter/counter-api.h:237:17: note: ‘move_sum’ declared here 237 | int64_t move_sum; | ^~~~~~~~ Change-Id: I65dc61a567c0337735124a35f1af96697d416054 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/src/common/counter/counter-api.h b/src/common/counter/counter-api.h index ce2bf06a..955c5bb2 100644 --- a/src/common/counter/counter-api.h +++ b/src/common/counter/counter-api.h @@ -234,7 +234,7 @@ static inline int __lttng_counter_add_percpu(const struct lib_counter_config *co struct lib_counter *counter, const size_t *dimension_indexes, int64_t v) { - int64_t move_sum; + int64_t move_sum = 0; int ret; ret = __lttng_counter_add(config, COUNTER_ALLOC_PER_CPU, config->sync,