On Thu, 31 Oct 2024 17:59:01 +0100 Tomas Kalibera <tomas.kalib...@gmail.com> wrote:
> for now, if you know an elegant, minimal way how to suppress > this, and have the time and energy, a patch would be welcome A fresh R-4.4.2 build compiled with clang-19 -fsanitize=function gives the error: $ bin/R -q -s -e 'library(survival); survdiff(Surv(futime, fustat) ~ rx,data=ovarian)' dotcode.c:2008:2: runtime error: call to function survdiff2 through pointer to incorrect function type 'void (*)(void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *, void *)' /tmp/RtmpW0SC00/R.INSTALL5d1b3402d0c5/survival/src/survdiff2.c:10: note: survdiff2 defined here SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior dotcode.c:2008:2 A suppression file will avoid the error without patching R: $ cat dotcode.supp function:dotcode.c or more fine-grained: $ cat dotcode.supp function:do_dotCode $ UBSAN_OPTIONS="suppressions=$(realpath dotcode.supp)" bin/R -q -s -e 'library(survival); survdiff(Surv(futime, fustat) ~ rx,data=ovarian)' Call: survdiff(formula = Surv(futime, fustat) ~ rx, data = ovarian) <and so on> Alternatively, the following patch will also suppress the error: --- src/main/dotcode.c 2024-03-26 23:02:08.000000000 +0000 +++ src/main/dotcode.c 2024-10-31 19:53:36.272334541 +0000 @@ -1658,6 +1658,9 @@ #define FILL 0xee #define NG 64 +#ifdef __clang__ +__attribute__((no_sanitize("function"))) +#endif attribute_hidden SEXP do_dotCode(SEXP call, SEXP op, SEXP args, SEXP env) { void **cargs, **cargs0 = NULL /* -Wall */; I hope I understood you correctly that you're looking for a tested workaround. -- Best regards, Ivan ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel