Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix a gcc -Werror=maybe-uninitialized warning in LTO mode. #3562
We have a gcc warning (error in our case since we use -Werror) when building some of our own code in LTO (link time optimisation) mode + statically linking curl which was also built with LTO mode. In practice, gcc will try at link time to optimize the whole program (so our own code + the curl code) in one go.
When doing that, with flags -Werror -Wall -Wextra, we get this warning (error):
I checked the code, and this definitely looks like a false positive (gcc generates quite often false positives with -Wmaybe-uninitialized which is implied by -Wall/-Wextra). I propose to silence the false positive by actually initializing the value even if it's useless. If that does not fly for you, we might consider another fix which is adding a pragma diagnostic to actually ignore this warning, that's up to you.