nasa / bplib

Apache License 2.0
30 stars 13 forks source link

Uninitialized variable warnings #236

Closed jphickey closed 1 year ago

jphickey commented 1 year ago

Describe the bug When using certain compiler options and/or newer compiler versions it is now warning about 3 instances of uninitialized variables in the unit test:

libs/bplib/cache/ut-coverage/test_bplib_cache_setup.c: In function ‘test_setup_cache_state’:
libs/bplib/cache/ut-coverage/test_bplib_cache_setup.c:30:5: error: ‘pending_list’ may be used uninitialized [-Werror=maybe-uninitialized]
   30 |     bplib_mpool_list_iter_goto_first(&pending_list, &list_it);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

libs/bplib/cache/ut-coverage/../src/v7_cache_internal.h: In function ‘test_bplib_cache_custody_find_dacs_match’:
libs/bplib/cache/ut-coverage/../src/v7_cache_internal.h:184:5: error: ‘node’ may be used uninitialized [-Werror=maybe-uninitialized]
  184 |     bplib_cache_entry_get_container(ptr, offsetof(bplib_cache_entry_t, member))
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

libs/bplib/v7/ut-coverage/test_v7_bp_bitmap.c: In function ‘test_v7_encode_bitmap’:
libs/bplib/v7/ut-coverage/test_v7_bp_bitmap.c:37:23: error: ‘v’ may be used uninitialized [-Werror=maybe-uninitialized]
   37 |     UtAssert_VOIDCALL(v7_encode_bitmap(&enc, v, ptbl));
      |                       ^~~~~~~~~~~~~~~~

To Reproduce Build using gcc 12.2.0 with full warnings enabled

Expected behavior Should be clean

System observed on: Debian

Reporter Info Joseph Hickey, Vantage Systems, Inc.