On 11/21/19 7:25 PM, Devin Incerti wrote:
Hi,
I'm attempting to submit a very minor update to my package where I replaced
a deprecated C++ function with an alternative. However, I'm receiving an
unrelated warning "*array subscript -1 is outside array bounds of ‘double
[52]’ [-Warray-bounds] *" on Debian during the CRAN pre-tests. I do not
receive this warning on my local OS X, Ubuntu 16.04 (on Travis-CI), with
Win-builder, or with R-hub builder. I also did not receive this warning on
previous submissions to CRAN, but it does now show up on the most recent CRAN
checks
<http://s.bl-1.com/h/cH9zB21r?url=https://cran.r-project.org/web/checks/check_results_hesim.html>
.
The warning is related to the header file integrate.h
<http://s.bl-1.com/h/cH9zB6Qt?url=https://github.com/hesim-dev/hesim/blob/master/inst/include/hesim/Rbase/integrate.h>,
which is just integrate.c
<http://s.bl-1.com/h/cH9zBCpw?url=https://github.com/wch/r-source/blob/5a156a0865362bb8381dcd69ac335f5174a4f60c/src/appl/integrate.c>
from
R source with function pointers replaced by C++ functors. These integration
functions are needed so that the package can integrate at the C++ level.
I don't know how to avoid this warning. Is it perhaps related to the
particular version of GCC used during the CRAN checks. Any thoughts or
suggestions would be much appreciated.
Thank you!
The warning is generated by GCC when inlining the function rdqelg(), I
can reproduce it with the integrate.c we have in R, but only if I add
"inline" to rdqelg() definition (GCC 6 and newer - on Ubuntu but that
should not matter). The inliner knows the callsite, so it knows that
what is being passed is an array (and not an arbitrary pointer), and
hence it emits the warning. It is not smart enough to know that the
first element of the new "array" will (unless there is a bug) never be
used. When not inlining and the function is compiled independently from
its callsites, it assumes it is a pointer, and hence there is no warning.
The code is automatically converted from Fortran, maybe these pointer
decrements in function prologues are to adjust to Fortran 1-based array
indexing. If you must use this modified copy of integrate.c from R,
perhaps a quick hack to get rid of the warning would be to avoid the
"inline" keywords in declarations of functions like rdqelg(). In a
perfect world, the code would be rewritten to more idiomatic C (not just
to avoid these decrements). Or perhaps the Fortran original could be used.
Tomas
()
Devin
[[alternative HTML version deleted]]
______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel
______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel