[Rd] Compilation Error when DEBUG_approx Toggled on in RISC-V

Jane He @|y@oh4 @end|ng |rom uc|@edu
Fri Feb 24 00:33:23 CET 2023


Hi all,

While compiling R to RISC-V64 architecture and debugging in R's C source
codes, I think I have found a small bug. Can anyone please verify whether
it is a real bug?

The possible bug lies in the file `R-4.2.2/src/library/stats/src/approx.c`
in function `R_approxfun` around line 148:

#ifdef DEBUG_approx
    REprintf("R_approxfun(x,y, nxy = %.0f, .., nout = %.0f, method = %d,
...)",
    (double)nxy, (double)nout, Meth->kind);
#endif

However, there is no `Meth` defined in this function, causing a compilation
error when `DEBUG_approx` is toggled on. The real `Meth` is actually
defined in the `approx1` function, and the Meth seen here is probably a
historical artifact that was never erased. To fix the error, I suggest
changing `Meth->kind` to `method` in the `R_approxfun` function as follows:

#ifdef DEBUG_approx
    REprintf("R_approxfun(x,y, nxy = %.0f, .., nout = %.0f, method = %d,
...)",
    (double)nxy, (double)nout, method);
#endif

If this is really an error, I hope this small fix will be helpful to the R
community.

Thank you for your time and consideration.

Best,
Jane He

_________
University of California, Irvine
Student of Master of Software Engineering
2022-2023 cohort

	[[alternative HTML version deleted]]



More information about the R-devel mailing list