Fix uninitialized variables in ecmult_multi test #759

pull jonasnick wants to merge 1 commits into bitcoin-core:master from jonasnick:fix-ecmult-multi-uninit changing 1 files +6 −4
  1. jonasnick commented at 9:01 AM on June 15, 2020: contributor

    Fixes #756

  2. Fix uninitialized variables in ecmult_multi test 2e7fc5b537
  3. real-or-random commented at 9:05 AM on June 15, 2020: contributor

    ACK 2e7fc5b5372067ecd33b2304e8c88ed6de98ff13 I inspected the diff. I did not test it and I did not check whether if makes the warning go away

  4. elichai commented at 12:43 PM on June 15, 2020: contributor

    tACK 2e7fc5b5372067ecd33b2304e8c88ed6de98ff13

    Before:

    $ gcc --version
    gcc (GCC) 10.1.0
    $ CFLAGS=-O3 ./configure
    ...
    Build Options:                                                                                                         
      with endomorphism       = no                   
      with ecmult precomp     = yes                 
      with external callbacks = no                                                                                         
      with benchmarks         = yes                  
      with coverage           = no                          
      module ecdh             = no
      module recovery         = no           
                                                               
      asm                     = x86_64     
      bignum                  = gmp                                                                                        
      field                   = 64bit
      scalar                  = 64bit          
      ecmult window size      = 15                        
      ecmult gen prec. bits   = 4                         
                                                               
      valgrind                = yes                       
      CC                      = gcc                                                                                        
      CFLAGS                  = -O2 -fvisibility=hidden -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -W -O3
      CPPFLAGS                =                                                                                            
      LDFLAGS                 =                           
    
    $ make
      CC       src/bench_verify-bench_verify.o                                                                             
    gcc -I. -I./src -Wall -Wextra -Wno-unused-function -g -O2 -c src/gen_context.c -o gen_context.o
    gcc -Wall -Wextra -Wno-unused-function -g -O2  gen_context.o -o gen_context
    ./gen_context                                      
      CC       src/libsecp256k1_la-secp256k1.lo
      CCLD     libsecp256k1.la
      CCLD     bench_verify
      CC       src/bench_sign.o
      CCLD     bench_sign
      CC       src/bench_internal-bench_internal.o
      CCLD     bench_internal
      CC       src/bench_ecmult-bench_ecmult.o
      CCLD     bench_ecmult
      CC       src/tests-tests.o
    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
      CC       src/valgrind_ctime_test.o
      CCLD     valgrind_ctime_test
      CC       src/exhaustive_tests-tests_exhaustive.o
      CCLD     exhaustive_tests
    

    After:

    $ gcc --version
    gcc (GCC) 10.1.0
    $ CFLAGS=-O3 ./configure
    ...
    Build Options:                                                                                                         
      with endomorphism       = no                   
      with ecmult precomp     = yes                 
      with external callbacks = no                                                                                         
      with benchmarks         = yes                  
      with coverage           = no                          
      module ecdh             = no
      module recovery         = no           
                                                               
      asm                     = x86_64     
      bignum                  = gmp                                                                                        
      field                   = 64bit
      scalar                  = 64bit          
      ecmult window size      = 15                        
      ecmult gen prec. bits   = 4                         
                                                               
      valgrind                = yes                       
      CC                      = gcc                                                                                        
      CFLAGS                  = -O2 -fvisibility=hidden -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -W -O3
      CPPFLAGS                =                                                                                            
      LDFLAGS                 =                           
    
    $ make  
      CC       src/bench_verify-bench_verify.o
    gcc -I. -I./src -Wall -Wextra -Wno-unused-function -g -O2 -c src/gen_context.c -o gen_context.o
    gcc -Wall -Wextra -Wno-unused-function -g -O2  gen_context.o -o gen_context
    ./gen_context
      CC       src/libsecp256k1_la-secp256k1.lo
      CCLD     libsecp256k1.la
      CCLD     bench_verify
      CC       src/bench_sign.o
      CCLD     bench_sign
      CC       src/bench_internal-bench_internal.o
      CCLD     bench_internal
      CC       src/bench_ecmult-bench_ecmult.o
      CCLD     bench_ecmult
      CC       src/tests-tests.o
      CCLD     tests
      CC       src/valgrind_ctime_test.o
      CCLD     valgrind_ctime_test
      CC       src/exhaustive_tests-tests_exhaustive.o
      CCLD     exhaustive_tests
    
  5. real-or-random merged this on Jun 15, 2020
  6. real-or-random closed this on Jun 15, 2020

  7. jasonbcox referenced this in commit f5b18bcffa on Sep 27, 2020
  8. deadalnix referenced this in commit 68e127fa01 on Sep 28, 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 19:15 UTC

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