ropensci / phylocomr

Phylocom R interface
https://docs.ropensci.org/phylocomr
Other
15 stars 7 forks source link

gcc compiler warnings #38

Closed LunaSare closed 1 year ago

LunaSare commented 1 year ago

R cran checks on gcc

Found the following significant warnings:
     libphylocom/io.c:129:36: warning: argument 2 of type ‘char[50]’ with mismatched bound [-Warray-parameter=]
     libphylocom/io.c:597:24: warning: argument 1 of type ‘char[50]’ with mismatched bound [-Warray-parameter=]
     libphylocom/io.c:767:24: warning: argument 1 of type ‘char[50]’ with mismatched bound [-Warray-parameter=]
     libphylocom/io.c:935:26: warning: argument 1 of type ‘char[50]’ with mismatched bound [-Warray-parameter=]
     libphylocom/new2fy.c:9:19: warning: argument 1 of type ‘char[50]’ with mismatched bound [-Warray-parameter=]
     libphylocom/ecomain.c:543:23: warning: argument 1 of type ‘char[11]’ with mismatched bound [-Warray-parameter=]
     libphylocom/phylomatic.c:298:27: warning: argument 1 of type ‘char[100]’ with mismatched bound [-Warray-parameter=]
LunaSare commented 1 year ago

First fix of [-Warray-parameter=] warning implemented on https://github.com/ropensci/phylocomr/commit/f5ca2d730c633363ba244276156caec08757c1b4

This returned warning [-Wstringop-overflow=], with fix implemented on https://github.com/ropensci/phylocomr/commit/e1010e47436a93ea3c20a612579c805cb7b5b9c5, e.g.:

  libphylocom/main.c:229:7: warning: 'ReadPhylogeny' accessing 50 bytes in a region of size 6 [-Wstringop-overflow=]

We are getting a new warning [-Wstringop-truncation] with devtools::::check_win_devel():

  libphylocom/io.c:868:15: warning: 'strncat' output may be truncated copying 1 byte from a string of length 999 [-Wstringop-truncation]
  libphylocom/io.c:818:19: warning: 'strncat' output may be truncated copying 1 byte from a string of length 999 [-Wstringop-truncation]