Compile of test fails with uninitialized variabes on Ubuntu 19.10 shared
njhammond opened this issue · 1 comments
Ubuntu 19.10.
Shared library installed
cd test
cp Makefiles/Makefile_linux Makefile
make
Get lots of errors of the form:
testcommon.cpp: In function ‘realMain.constprop’:
testcommon.cpp:155:7: error: ‘trace_list’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
155 | free(trace_list);
| ^
testcommon.cpp:89:16: note: ‘trace_list’ was declared here
89 | solvedPlay * trace_list;
| ^
Fix:
In testcommon.cpp, add initializations
int number = 0;
int * dealer_list = 0;
int * vul_list = 0;
dealPBN * deal_list = 0;
futureTricks * fut_list = 0;
ddTableResults * table_list = 0;
parResults * par_list = 0;
parResultsDealer * dealerpar_list = 0;
playTracePBN * play_list = 0;
solvedPlay * trace_list = 0;
There are other ways of fixing, for example changing the compiler settings, but best to just initialize the variables.
Thanks. Fixed in next release.