MrBayes
MrBayes copied to clipboard
compiler warnings
I got a bunch of compiler warnings when compiling a mpi version on Ubuntu 20.04.2 LTS using code from the current develop branch, please see the file attached. warnings.txt
There are four or five types of compiler warnings in the warnings.txt
file:
-
gcc: warning: switch ‘-mmpx’ is no longer supported
This comes from an incompatibility between anautoconf
macro and GNUgcc
. It is harmless. -
warning: variable ‘some variable name’ set but not used [-Wunused-but-set-variable]
This should easily be fixed after verifying that the named variable is actually not used in all code paths. I will look at this eventually. -
warning: ‘j’ may be used uninitialized in this function [-Wmaybe-uninitialized]
Yeah, I suppose that theoretically, this may be the case. However, the code around these warnings is usually so convoluted (nested nests of nesting) so it near impossible to figure out whether the variable has the correct value or not under all conceivable circumstances. I honestly can't do anything about these warnings. -
warning: ‘%d’ directive writing between 1 and 10 bytes into a region of size between 7 and 126 [-Wformat-overflow=]
I fixed a bunch of these some time ago (bu increasing the sizes of some filename-related string buffers), but we will not track down all of the instances where the static analyzer identifies issues. This is mostly due to the difficulty in following how string buffers are allocated and passed around. This also goes for the[-Wrestrict]
warnings.
I have fixed the warnings in commit fdfa193. I tested the compilation in both Ubuntu 20.04.6 LTS (gcc version 9.4.0) and macOS Ventura 13.3 (Xcode 14.3, clang version 14.0.3), and confirmed they are gone.