I confirm it is valgrind behavior, it does not preserve the NaN payload
when converting 80-bit and 64-bit floating point numbers on Intel (also
it treats denormals as zero, more information is in comments in valgrind
source, file guest_generic_x87.c).
The quick-hack patch below can be applied
I can reproduce on my system, running an unoptimized R build (-O0) in
valgrind produces NaN (valgrind 3.15.0, gcc 9.3.0 - Ubuntu 20.04/x86_64)
for the example, but without valgrind it produces NA.
Valgrind modifies the binary code before running it and this is probably
what is causing the diff
Forgot to mention, my builds were not instrumented for valgrind, and also:
vagrant@vagrant:/vagrant/trunk$ ./bin/R --version
R Under development (unstable) (2021-04-27 r80232) -- "Unsuffered Consequences"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (
> On Thursday, April 29, 2021, 6:35:16 PM EDT, Winston Chang
> wrote:
> Just to be clear, the RD binary that Jon used was NOT compiled with
> Valgrind level 2 instrumentation. In his example, however, he did run it
> with valgrind, as in:
>
> # RD -d valgrind --quiet -e "sum(c(1, NA))"
> ...
>
Just to be clear, the RD binary that Jon used was NOT compiled with
Valgrind level 2 instrumentation. In his example, however, he did run it
with valgrind, as in:
# RD -d valgrind --quiet -e "sum(c(1, NA))"
...
> sum(c(1, NA))
[1] NaN
`RD` in that Docker image is a standard build of R-devel. The D
NA propagation is complicated. I don't know whether what
you observe could be explained by the difference between
a valgrind instrumented vs. not version of R (I gather the
release version you used is not instrumented / possibly
compiled differently too from the github issue?).
Hopefully someone
Hello,
I'm debugging some valgrind issues, and noticed some odd behavior with
NA an R-devel under valgrind.
Using Winston Chang's r-debug image (and some of this reproductions form [1]):
r-devel (2021-04-27 r80232) without Valgrind returns NA:
# RD --quiet -e "sum(c(1, NA))"
> sum(c(1, NA))
[1]