Compile on GCC 10.1.0 will get error:
src/relic.cpp: In member function ‘load’:
src/weighted_list.h:13:83: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
13 | weighted_object( const T &obj, const W &weight ) : obj( obj ), weight( weight ) {}
| ^
src/relic.cpp:128:34: note: ‘val’ was declared here
128 | relic_procgen_data::type val;
| ^
wget https://raw.githubusercontent.com/Aloxaf/aur-build/master/script/packages/cataclysmdda-git/PKGBUILD
makepkg
Build without any error
Build from master, using compiler as close as possible to yours and it works.
gcc --version
gcc (Debian 10.1.0-4) 10.1.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
g++ --version
g++ (Debian 10.1.0-4) 10.1.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#define VERSION "0.E-4155-g9f82fd3034"
please provide additional information on your source version (either git commit or simply a version of cata you are building), or try again with unchanged (clean) source code.
Ok, confirmed. It only happens for LTO=1 builds from the Makefile and this should fix it:
```diff --git a/src/relic.cpp b/src/relic.cpp
index c71be68ade..3caab28296 100644
--- a/src/relic.cpp
+++ b/src/relic.cpp
@@ -125,7 +125,7 @@ void relic_procgen_data::load( const JsonObject &jo, const std::string & )
for( const JsonObject &jo_inner : jo.get_array( "type_weights" ) ) {
int weight = 0;
mandatory( jo_inner, was_loaded, "weight", weight );
- relic_procgen_data::type val;
+ relic_procgen_data::type val = relic_procgen_data::type::last;
mandatory( jo_inner, was_loaded, "value", val );
type_weights.add( val, weight );
```
Most helpful comment
Ok, confirmed. It only happens for LTO=1 builds from the Makefile and this should fix it:
```diff --git a/src/relic.cpp b/src/relic.cpp
index c71be68ade..3caab28296 100644
--- a/src/relic.cpp
+++ b/src/relic.cpp
@@ -125,7 +125,7 @@ void relic_procgen_data::load( const JsonObject &jo, const std::string & )
for( const JsonObject &jo_inner : jo.get_array( "type_weights" ) ) {
int weight = 0;
mandatory( jo_inner, was_loaded, "weight", weight );
- relic_procgen_data::type val;
+ relic_procgen_data::type val = relic_procgen_data::type::last;
mandatory( jo_inner, was_loaded, "value", val );
```