Fix: may be used uninitialized on powerpc
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 18 Jan 2022 19:14:33 +0000 (19:14 +0000)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 26 Jan 2022 18:51:56 +0000 (13:51 -0500)
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 <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/common/counter/counter-api.h

index ce2bf06a4dc9ca8636afd879ad146b77d7f00963..955c5bb2927cbf621f007167a1d8feb30a032f5b 100644 (file)
@@ -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,
This page took 0.027179 seconds and 4 git commands to generate.