Skip to content

-Wmaybe-uninitialized when compiling with -O1 #1361

@hebasto

Description

@hebasto
$ ./autogen.sh && ./configure CFLAGS=-O1
$ make clean > /dev/null && make > /dev/null 
In file included from src/secp256k1.c:30:
In function 'secp256k1_ecmult_strauss_wnaf',
    inlined from 'secp256k1_ecmult' at src/ecmult_impl.h:353:5:
src/ecmult_impl.h:291:5: warning: 'aux' may be used uninitialized [-Wmaybe-uninitialized]
  291 |     secp256k1_ge_table_set_globalz(ECMULT_TABLE_SIZE(WINDOW_A) * no, state->pre_a, state->aux);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/secp256k1.c:29:
src/group_impl.h: In function 'secp256k1_ecmult':
src/group_impl.h:224:13: note: by argument 3 of type 'const secp256k1_fe *' to 'secp256k1_ge_table_set_globalz' declared here
  224 | static void secp256k1_ge_table_set_globalz(size_t len, secp256k1_ge *a, const secp256k1_fe *zr) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ecmult_impl.h:345:18: note: 'aux' declared here
  345 |     secp256k1_fe aux[ECMULT_TABLE_SIZE(WINDOW_A)];
      |                  ^~~
In file included from src/secp256k1.c:30,
                 from src/bench_internal.c:8:
In function ‘secp256k1_ecmult_strauss_wnaf’,
    inlined from ‘secp256k1_ecmult’ at src/ecmult_impl.h:353:5:
src/ecmult_impl.h:291:5: warning: ‘aux’ may be used uninitialized [-Wmaybe-uninitialized]
  291 |     secp256k1_ge_table_set_globalz(ECMULT_TABLE_SIZE(WINDOW_A) * no, state->pre_a, state->aux);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/secp256k1.c:29:
src/group_impl.h: In function ‘secp256k1_ecmult’:
src/group_impl.h:224:13: note: by argument 3 of type ‘const secp256k1_fe *’ to ‘secp256k1_ge_table_set_globalz’ declared here
  224 | static void secp256k1_ge_table_set_globalz(size_t len, secp256k1_ge *a, const secp256k1_fe *zr) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ecmult_impl.h:345:18: note: ‘aux’ declared here
  345 |     secp256k1_fe aux[ECMULT_TABLE_SIZE(WINDOW_A)];
      |                  ^~~

Using gcc 12.2.

No warnings with clang 15.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions