maybe-uninit warning in tests.c #756

issue elichai opened this issue on June 4, 2020
  1. elichai commented at 12:03 PM on June 4, 2020: contributor

    With gcc-10 under -O3 I get:

    src/tests.c: In function ‘test_ecmult_multi_batch_single.constprop’:
    src/tests.c:2716:9: warning: ‘sc’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     2716 |     *sc = data->sc[idx];
          |     ~~~~^~~~~~~~~~~~~~~
    src/tests.c:2717:9: warning: ‘pt’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     2717 |     *pt = data->pt[idx];
          |     ~~~~^~~~~~~~~~~~~~~
    src/tests.c:2717:9: warning: ‘*((void *)&pt+16)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    src/tests.c:2717:9: warning: ‘pt.x.n[4]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    src/tests.c:2717:9: warning: ‘*((void *)&pt+40)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    src/tests.c:2717:9: warning: ‘*((void *)&pt+48)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    src/tests.c:2717:9: warning: ‘*((void *)&pt+64)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    src/tests.c:2717:9: warning: ‘pt.y.n[4]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    src/tests.c:2717:9: warning: ‘*((void *)&pt+88)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    src/tests.c:2717:9: warning: ‘pt.infinity’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      CCLD     tests
    
  2. real-or-random commented at 1:03 PM on June 4, 2020: contributor

    These are indeed not initialized: https://github.com/bitcoin-core/secp256k1/blob/master/src/tests.c#L2970-L2971 Also I don't get why this needs to be an array of size 32, maybe copy/paste mistake from the function one above.

  3. jonasnick cross-referenced this on Jun 15, 2020 from issue Fix uninitialized variables in ecmult_multi test by jonasnick
  4. real-or-random closed this on Jun 15, 2020

  5. real-or-random closed this on Jun 15, 2020


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-18 21:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me