nasa / bplib

Apache License 2.0
27 stars 13 forks source link

GCC Compile errors when using full optimizations #201

Closed jphickey closed 1 year ago

jphickey commented 1 year ago

Describe the bug When compiling with full optimizations enabled, gcc detects and reports some additional errors that are not seen when compiling in debug mode.

For example:

/home/joe/code/cfecfs/github/libs/bplib/mpool/src/v7_mpool.c: In function ‘bplib_mpool_search_list’:
/home/joe/code/cfecfs/github/libs/bplib/mpool/src/v7_mpool.c:841:16: error: ‘iter.position’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  841 |     return iter.position;
      |            ~~~~^~~~~~~~~
cc1: all warnings being treated as errors

To Reproduce Compile with CMAKE_BUILD_TYPE set to Release.

Expected behavior Should build and run cleanly

System observed on: Ubuntu 22.04 (gcc 11.3)

Reporter Info Joseph Hickey, Vantage Systems, Inc.