Jane He
2023-Feb-23 23:33 UTC
[Rd] Compilation Error when DEBUG_approx Toggled on in RISC-V
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]]
Martin Maechler
2023-Feb-24 15:03 UTC
[Rd] Compilation Error when DEBUG_approx Toggled on in RISC-V
>>>>> Jane He >>>>> on Thu, 23 Feb 2023 15:33:23 -0800 writes:> 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. well, you are right this has been a cut'n'paste thinko (almost surely by me) that has probably never shown but to the 0, 1, or 2 people in the world who may have manually compiled *and* defined DEBUG_approx .. > Thank you for your time and consideration. and to you, too! The fixed is part of the source now. Best, Martin > Best, > Jane He > _________ > University of California, Irvine > Student of Master of Software Engineering > 2022-2023 cohort > [[alternative HTML version deleted]] > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel