You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
New warnings from -Wconversion -Wno-sign-conversion #1299
Prof Ripley emailed the following in a messaging concerning the earlier R_NO_MAP issue (that is apparently defered for a bit at CRAN, we did our bit here, he pointed me also to another issue in another package of mine now taken care of):
A couple of other warnings I noted whilst compiler logs for CRAN
packages scrolled by:
/Users/ripley/R/Library/Rcpp/include/Rcpp/sugar/functions/sample.h:369:17:
warning: implicit conversion loses integer precision: 'R_xlen_t' (aka
'long') to 'int' [-Wshorten-64-to-32]
/Users/ripley/R/Library/Rcpp/include/Rcpp/internal/export.h:114:9:
warning: implicit conversion loses integer precision: 'R_xlen_t' (aka
'long') to 'uword' (aka 'unsigned int') [-Wshorten-64-to-32]
(That's from clang with -Wconversion -Wno-sign-conversion.)
I am actually not sure I can reproduce these with clang++-17, at least not from building Rcpp. uword hints at RcppArmadillo but it could also be any one of 1100+ packages using it. Uggh.
I looked into this some more. One can tickle a fair amount by for example testing our embedded package testRcppClass via the test file test_module_client_package.R. And while I can subsitute a number of int for size_t invariably I end at an impassed that I convert enough to silence all warnings, the module no longer loads. Uggh. One can backtrack and only convert 'some' and the module remains loadable, but so does a faily warning. The main culprit (for this issue) appears to be this function. I changed some more trivial things (adding void to signatures in init.c for the test package, a number of other int -> size_t in class.h) but this one stings.
So we -Wconversion -Wno-sign-conversion under clang are enforced we may have some trouble.
I looked into this some more. One can tickle a fair amount by for example testing our embedded package testRcppClass via the test file test_module_client_package.R. And while I can subsitute a number of int for size_t invariably I end at an impassed that I convert enough to silence all warnings, the module no longer loads.
Do you have a branch with this to apply another pair of eyes?
Hah! Following #1303 this is now different and (for the one test I looked at) much quieter. Will keep looking. Not so. I forgot the required setters for expanded tests.
And lo and behold it is in better shape now as #1303 helped us here too it seems. To recap, I used this is ~/.R/Makevars` to get the appropriate compiler and the two important flags:
With that I ran the following snippet repeatedly (as we by the design of our tests have to reinstall to have the updated headers used) from directory inst/tinytest.r
cd ../..; ./cleanup; install.r;cd -; RunVerboseRcppTests=yes RunAllRcppTests=yes tt.r -f test_module_client_package.R
where install.r and tt.r are simple helpers from littler to run R CMD INSTALL with preferred flags and to run a single test file via tinytest (i.e. tinytest::run_test_file(filename)).
Hi @JanMarvin that is helpful as we likely do need additional rounds of fixes as different packages will expose different parts of the "API surface". Which package did you compile?
VBel: lots of warnings from RcppEigen (another time ...), the one reported on Vector does not reproduce anymore so yay us!
lavacreg: false positive in search, package compilation log no longer there
hdtg: only from other packages: RcppEigen, RcppXsimd, RcppParallel, own package source code
mapdeck: false positive in search, package compilation log no longer there
morf: no longer on CRAN
I will try to get to these one by one. Help welcome 😀 . I will also push a new branch with the change suggested by @JanMarvin and we can combine changes in there.
PS We could fetch support and morf from their Archive sections ...
Activity
eddelbuettel commentedon Mar 12, 2024
I am actually not sure I can reproduce these with
clang++-17, at least not from building Rcpp.uwordhints at RcppArmadillo but it could also be any one of 1100+ packages using it. Uggh.Enchufa2 commentedon Mar 12, 2024
I assume you asked Prof. Ripley for more details. :) In the meantime, I found this for the second one via Google search, nothing for the first one.
eddelbuettel commentedon May 26, 2024
I looked into this some more. One can tickle a fair amount by for example testing our embedded package
testRcppClassvia the test filetest_module_client_package.R. And while I can subsitute a number ofintforsize_tinvariably I end at an impassed that I convert enough to silence all warnings, the module no longer loads. Uggh. One can backtrack and only convert 'some' and the module remains loadable, but so does a faily warning. The main culprit (for this issue) appears to be this function. I changed some more trivial things (addingvoidto signatures ininit.cfor the test package, a number of otherint->size_tinclass.h) but this one stings.So we
-Wconversion -Wno-sign-conversionunder clang are enforced we may have some trouble.Enchufa2 commentedon May 27, 2024
Do you have a branch with this to apply another pair of eyes?
eddelbuettel commentedon May 27, 2024
Hah! Following #1303 this is now different and (for the one test I looked at) much quieter. Will keep looking.Not so. I forgot the required setters for expanded tests.And lo and behold it is in better shape now as #1303 helped us here too it seems. To recap, I used this is ~/.R/Makevars` to get the appropriate compiler and the two important flags:
With that I ran the following snippet repeatedly (as we by the design of our tests have to reinstall to have the updated headers used) from directory
inst/tinytest.rwhere
install.randtt.rare simple helpers fromlittlerto runR CMD INSTALLwith preferred flags and to run a single test file viatinytest(i.e.tinytest::run_test_file(filename)).eddelbuettel commentedon May 27, 2024
New branch bugfix/size_t_casts pushed.
It behaves here. I think the key difference to what gave me minor trouble yesterday is the one-line change in Module.h.
Enchufa2 commentedon May 28, 2024
(Note to self) Packages to check for more casts:
support,lavacreg,hdtg,mapdeck,morfFound using this search:
JanMarvin commentedon Jun 1, 2024
Hi, not sure if further input is still needed, but I saw the following warning when compiling with clang 17.0.6 and
-Wconversion -Wno-sign-conversionThis I was able to silence switching
inttoR_xlen_there:Rcpp/inst/include/Rcpp/internal/Proxy_Iterator.h
Line 34 in b694118
eddelbuettel commentedon Jun 1, 2024
Hi @JanMarvin that is helpful as we likely do need additional rounds of fixes as different packages will expose different parts of the "API surface". Which package did you compile?
JanMarvin commentedon Jun 1, 2024
Hi @eddelbuettel , I was compiling
openxlsx2. The warning is triggered by a customwrap()function in a_types.hfile with#include <RcppCommon.h>eddelbuettel commentedon Jun 1, 2024
Confirming. An alternative (more local?) fix would be
which is more local but your suggestion is likely better. But may require more testing.
eddelbuettel commentedon Jun 1, 2024
@Enchufa2 You search string is good! I see
I will try to get to these one by one. Help welcome 😀 . I will also push a new branch with the change suggested by @JanMarvin and we can combine changes in there.
PS We could fetch
supportandmorffrom their Archive sections ...eddelbuettel commentedon Jun 5, 2024
That worked out ok in the rev.dep check so I will make another PR.
eddelbuettel commentedon Jul 27, 2024
Closing as #1309 covered this.