amkozlov / raxml-ng

RAxML Next Generation: faster, easier-to-use and more flexible
GNU Affero General Public License v3.0
374 stars 62 forks source link

Wrong formal parameter name in function pllmod_set_error() in <SOURCEDIR>\libs\pll-modules\src\pllmod_common.{c,h} #138

Closed jdx-gh closed 1 year ago

jdx-gh commented 2 years ago

I am porting raxml-ng to Windows and noticed following warning:

gcc.exe -Wall -std=c99 -Wsign-compare -DGNU_SOURCE -g -DDEBUG -I..\..\libs\pll-modules\libs\libpll\src -c D:\Works\raxml-ng\libs\pll-modules\src\binary\binary_io_operations.c -o obj\Debug\libs\pll-modules\src\binary\binary_io_operations.c.o
In file included from D:\Works\raxml-ng\libs\pll-modules\src\binary\binary_io_operations.h:24,
                 from D:\Works\raxml-ng\libs\pll-modules\src\binary\binary_io_operations.c:30:
D:\Works\raxml-ng\libs\pll-modules\src\binary\binary_io_operations.c: In function 'binary_repeats_apply':
D:\Works\raxml-ng\libs\pll-modules\src\binary\pll_binary.h:52:49: warning: passing argument 1 of 'pllmod_set_error' makes pointer from integer without a cast [-Wint-conversion]
   52 | #define PLLMOD_BIN_ERROR_LOADSTORE              4012
      |                                                 ^~~~
      |                                                 |
      |                                                 int
D:\Works\raxml-ng\libs\pll-modules\src\binary\binary_io_operations.c:338:22: note: in expansion of macro 'PLLMOD_BIN_ERROR_LOADSTORE'
  338 |     pllmod_set_error(PLLMOD_BIN_ERROR_LOADSTORE,
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ..\..\libs\pll-modules\libs\libpll\src/pll.h:27,
                 from D:\Works\raxml-ng\libs\pll-modules\src\binary\pll_binary.h:26,
                 from D:\Works\raxml-ng\libs\pll-modules\src\binary\binary_io_operations.h:24,
                 from D:\Works\raxml-ng\libs\pll-modules\src\binary\binary_io_operations.c:30:
D:/Works/raxml-ng/libs/pll-modules/src/pllmod_common.h:43:27: note: expected 'int * (*)()' but argument is of type 'int'
   43 | void pllmod_set_error(int errno, const char* errmsg_fmt, ...);
      |                           ^

In order to clearly illustrate the issue please compile following program with and without #include <errno.h>:

/* Compile command: gcc -Wall errtest.c */

#include <errno.h>

int foo(int errno)
{
  return errno;
}

int main(int argc, char *argv[])
{
  foo(12345);
}

Gcc 11.2 on Windows and Linux gives the same results. Solution is of course trivial – just rename the parameter to e.g. errcode.

jdx-gh commented 2 years ago

FYI, due to this "innocent issue" tests were ended with "segmentation fault". So now I have kinda strange situation on Windows: the program and tests are build successfully, all tests pass, but the program itself ends with "segmentation fault".

jdx-gh commented 1 year ago

Moved to the right place: ddarriba/pll-modules#28