[R-pkg-devel] seeking help regarding the valgrind error

Serguei Sokol @ergue|@@oko| @end|ng |rom gm@||@com
Tue Jan 14 18:03:28 CET 2020


Hi Yang,

Le 14/01/2020 à 17:29, Yang Feng a écrit :
> Hi All,
> 
> Happy new year! I just joined this mailing list and would like to post my
> first question.
> 
> I received a message earlier this month regarding an error in my R package
> RAMP https://cran.r-project.org/web/packages/RAMP/index.html
> I need to update the package by the end of this month to prevent it from
> removed from CRAN.
> 
> The detailed email message is as follows. Does anyone know how to fix this?
Yep. The default value for gamma parameter in RAMP is NULL. So when you 
do in cd.general.R:

	para.in = c(epsilon, max.iter, lambda, gamma)

and later on in .Fortran() call

	..., paraIn = as.double(para.in) ...

you obtain a vector of length 3 while it is expected to be of length 4 
in cd_general_lin.f:

	double precision, dimension(4) :: paraIn

So that when you read the 4-th element on line 21:

	gamma = paraIn(4)

you are caught by valgrid.

Fixing that is left as exercise ;)

Best,
Serguei.


> Also, how to reproduce this kind of error on my local mac?
> 
> Many thanks!
> 
> 
> Checking with valgrind shows:
> 
> Still
> 
>   > fit1 = RAMP(x, y)
> ==4663== Invalid read of size 8
> ==4663==    at 0x48A0A51: cd_general_lin_
> (/tmp/RAMP.Rcheck/00_pkg_src/RAMP/src/cd_general_lin.f:21)
> ==4663==    by 0x49DDE6: do_dotCode (svn/R-devel/src/main/dotcode.c:1799)
> ==4663==    by 0x4D181C: bcEval (svn/R-devel/src/main/eval.c:7054)
> ==4663==    by 0x4E8197: Rf_eval (svn/R-devel/src/main/eval.c:688)
> ==4663==    by 0x4E9D56: R_execClosure (svn/R-devel/src/main/eval.c:1853)
> ==4663==    by 0x4EAB33: Rf_applyClosure (svn/R-devel/src/main/eval.c:1779)
> ==4663==    by 0x4DB64D: bcEval (svn/R-devel/src/main/eval.c:7022)
> ==4663==    by 0x4E8197: Rf_eval (svn/R-devel/src/main/eval.c:688)
> ==4663==    by 0x4E9D56: R_execClosure (svn/R-devel/src/main/eval.c:1853)
> ==4663==    by 0x4EAB33: Rf_applyClosure (svn/R-devel/src/main/eval.c:1779)
> ==4663==    by 0x4E8363: Rf_eval (svn/R-devel/src/main/eval.c:811)
> ==4663==    by 0x4ECD01: do_set (svn/R-devel/src/main/eval.c:2920)
> ==4663==  Address 0x1616c100 is 7,600 bytes inside a block of size 7,960
> alloc'd
> ==4663==    at 0x483880B: malloc
> (/builddir/build/BUILD/valgrind-3.15.0/coregrind/m_replacemalloc/vg_replace_malloc.c:309)
> ==4663==    by 0x5223E0: GetNewPage (svn/R-devel/src/main/memory.c:946)
> 
> Please fix and resubmit.
> 
> Best wishes,
> Yang
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>



More information about the R-package-devel mailing list