[Rd] Difference in NA behavior in R-devel running under valgrind

Winston Chang w|n@tonch@ng1 @end|ng |rom gm@||@com
Fri Apr 30 00:35:04 CEST 2021


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 Docker image
does include a build of R-devel with valgrind level 2 instrumentation,
called `RDvalgrind`. It exhibits the same NaN behavior when run with `-d
valgrind`, but when run without `-d valgrind` it returns NA.

# RDvalgrind -d valgrind --quiet -e "sum(c(1, NA))"
> sum(c(1, NA))
[1] NaN

# RDvalgrind --quiet -e "sum(c(1, NA))"
> sum(c(1, NA))
[1] NA

In short `RDvalgrind` behaves the same as `RD`. However, adding `-d
valgrind` to either one causes it to return NaN.

-Winston


On Thu, Apr 29, 2021 at 5:27 PM brodie gaslam via R-devel <
r-devel using r-project.org> wrote:

> 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 more knowledgeable would chime in, but
> I did want to share Tomas's post that touches on the
> complexity of NA_real_ propagation:
>
>
> https://developer.r-project.org/Blog/public/2020/11/02/will-r-work-on-apple-silicon/#nanan-payload-propagation
>
> Best,
>
> B.
>
>
>
>
>
>
> On Thursday, April 29, 2021, 6:04:38 PM EDT, Jonathan Keane <
> jkeane using gmail.com> wrote:
>
>
>
>
>
> 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] NA
>
>
> r-devel with `-d valgrind` returns NaN:
> # RD -d valgrind --quiet -e "sum(c(1, NA))"
> ==8901== Memcheck, a memory error detector
> ==8901== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
> ==8901== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
> ==8901== Command: /usr/local/RD/lib/R/bin/exec/R --quiet -e sum(c(1,~+~NA))
> ==8901==
> > sum(c(1, NA))
> [1] NaN
>
>
> And finally release R (with valgrind) returns NA just like r-devel
> while not under Valgrind:
> # R -d valgrind --quiet -e "sum(c(1, NA))"
> ==8983== Memcheck, a memory error detector
> ==8983== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
> ==8983== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
> ==8983== Command: /usr/lib/R/bin/exec/R --quiet -e sum(c(1,~+~NA))
> ==8983==
> > sum(c(1, NA))
> [1] NA
>
> Thanks
>
> [1] - https://github.com/wch/r-debug/issues/18
>
> -Jon
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

	[[alternative HTML version deleted]]



More information about the R-devel mailing list