From ripley at stats.ox.ac.uk  Wed Dec 30 16:45:59 2009
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 30 Dec 2009 15:45:59 +0000 (GMT)
Subject: [Rd] different behaviour of NAs under valgrind (PR#14171)
In-Reply-To: <20091229010510.D84E9282EEFA@mail.pubhealth.ku.dk>
References: <20091229010510.D84E9282EEFA@mail.pubhealth.ku.dk>
Message-ID: <alpine.LFD.2.00.0912292041440.3307@gannet.stats.ox.ac.uk>

On Tue, 29 Dec 2009, schlather at math.uni-goettingen.de wrote:

> Full_Name: Martin Schlather
> Version: 2.10.0

Not current ....
> OS: linux

Not really specific enough to be helpful: these things depend on the 
compiler and libc.

> Submission from: (NULL) (91.3.220.231)
>
> Bug summary:
>    some functions behave differently for NAs when
>    valgrind is used in R, e.g. sum and prod

Why is that something to be reported to R-bugs?

For me (with the current valgrind 3.5.0 on i686 Fedora 12) exactly the 
same compiled code gives different results when run natively and under 
valgrind.  That looks very like a bug in valgrind's runtime, and it is 
incomprehensible as to why you assign blame to R.


>
> Bug demonstration:
> ---  without  valgrind ----
>>  sum(c(NA,1)[1])
> [1] NA
>
> ---  with  valgrind ----
>> sum(c(NA,1)[1])
> [1] NaN
>
>
> R call with valgrind:
> R -d "valgrind --tool=memcheck --memcheck:leak-check=yes --num-callers=20 "
>
> using
> valgrind-3.3.0
>
>
> platform = i686-pc-linux-gnu
> arch = i686
> os = linux-gnu
> system = i686, linux-gnu
> status =
> major = 2
> minor = 10.0
> year = 2009
> month = 10
> day = 26
> svn rev = 50208
> language = R
> version.string = R version 2.10.0 (2009-10-26)
>
> Locale:
> LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C
>
> Search Path:
> .GlobalEnv, package:stats, package:graphics, package:grDevices, package:utils,
> package:datasets, package:methods, Autoloads, package:base
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] different behaviour of NAs under valgrind (PR#14171)
Prof Brian Ripley