From r|p|ey @end|ng |rom @t@t@@ox@@c@uk  Wed Jun 10 06:12:04 2020
From: r|p|ey @end|ng |rom @t@t@@ox@@c@uk (Prof Brian Ripley)
Date: Wed, 10 Jun 2020 05:12:04 +0100
Subject: [Rd] valgrind false positive on R startup?
In-Reply-To: <CALK03d1zKdgcwhnRfM-kNgVQvXGmzN_WitwuREsbwoJsDZpVkA@mail.gmail.com>
References: <CALK03d1zKdgcwhnRfM-kNgVQvXGmzN_WitwuREsbwoJsDZpVkA@mail.gmail.com>
Message-ID: <47483e13-3582-8998-5be3-3f84fbc02b28@stats.ox.ac.uk>

It is known, with a known workaround, see e.g. 
https://www.stats.ox.ac.uk/pub/bdr/memtests/README.txt .  Set 
suppressions in ~/.valgrindrc, e.g. the CRAN check machine has

--suppressions=/data/blackswan/ripley/wcsrtombs.supp

It is an issue in your OS (glibc), not TRE nor R.

On 10/06/2020 00:21, Toby Hocking wrote:
> Hi all,
> 
> I'm on Ubuntu 18.04, running R-4.0.0 which I compiled from source, and
> using valgrind I am always seeing the following message. Does anybody
> else see that? Is that a known false positive? Any ideas how to
> fix/suppress? Seems related to TRE, do I need to upgrade that?
> 
> (base) tdhock at maude-MacBookPro:~/R/binsegRcpp$ R --vanilla -d valgrind
> -e 'extSoftVersion()'
> ==9565== Memcheck, a memory error detector
> ==9565== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
> ==9565== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
> ==9565== Command: /home/tdhock/lib/R/bin/exec/R --vanilla -e extSoftVersion()
> ==9565==
> ==9565== Conditional jump or move depends on uninitialised value(s)
> ==9565==    at 0x55AB9E0: __wcsnlen_sse4_1 (strlen.S:147)
> ==9565==    by 0x5598EC1: wcsrtombs (wcsrtombs.c:104)
> ==9565==    by 0x551EB20: wcstombs (wcstombs.c:34)
> ==9565==    by 0x50BAA07: wcstombs (stdlib.h:154)
> ==9565==    by 0x50BAA07: tre_parse_bracket_items (tre-parse.c:336)
> ==9565==    by 0x50BAA07: tre_parse_bracket (tre-parse.c:453)
> ==9565==    by 0x50BAA07: tre_parse (tre-parse.c:1380)
> ==9565==    by 0x50B2498: tre_compile (tre-compile.c:1920)
> ==9565==    by 0x50AFBE0: tre_regcompb (regcomp.c:150)
> ==9565==    by 0x4FA9F42: do_gsub (grep.c:2023)
> ==9565==    by 0x4F79045: bcEval (eval.c:7090)
> ==9565==    by 0x4F8572F: Rf_eval (eval.c:723)
> ==9565==    by 0x4F8754E: R_execClosure (eval.c:1888)
> ==9565==    by 0x4F88316: Rf_applyClosure (eval.c:1814)
> ==9565==    by 0x4F85902: Rf_eval (eval.c:846)
> ==9565==
> 
> R version 4.0.0 (2020-04-24) -- "Arbor Day"
> Copyright (C) 2020 The R Foundation for Statistical Computing
> Platform: x86_64-pc-linux-gnu (64-bit)
> 
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
> 
>    Natural language support but running in an English locale
> 
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
> 
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
> 
>> extSoftVersion()
>                                  zlib                                bzlib
>                              "1.2.11"                 "1.0.6, 6-Sept-2010"
>                                    xz                                 PCRE
>                               "5.2.2"                   "10.31 2018-02-12"
>                                   ICU                                  TRE
>                                "60.2"            "TRE 0.8.0 R_fixes (BSD)"
>                                 iconv                             readline
>                          "glibc 2.27"                                "7.0"
>                                  BLAS
> "/home/tdhock/lib/R/lib/libRblas.so"
>>
>>
> ==9565==
> ==9565== HEAP SUMMARY:
> ==9565==     in use at exit: 40,492,919 bytes in 9,170 blocks
> ==9565==   total heap usage: 19,784 allocs, 10,614 frees, 62,951,535
> bytes allocated
> ==9565==
> ==9565== LEAK SUMMARY:
> ==9565==    definitely lost: 0 bytes in 0 blocks
> ==9565==    indirectly lost: 0 bytes in 0 blocks
> ==9565==      possibly lost: 0 bytes in 0 blocks
> ==9565==    still reachable: 40,492,919 bytes in 9,170 blocks
> ==9565==                       of which reachable via heuristic:
> ==9565==                         newarray           : 4,264 bytes in 1 blocks
> ==9565==         suppressed: 0 bytes in 0 blocks
> ==9565== Rerun with --leak-check=full to see details of leaked memory
> ==9565==
> ==9565== For counts of detected and suppressed errors, rerun with: -v
> ==9565== Use --track-origins=yes to see where uninitialised values come from
> ==9565== ERROR SUMMARY: 46 errors from 1 contexts (suppressed: 0 from 0)
> (base) tdhock at maude-MacBookPro:~/R/binsegRcpp$
> 
> ______________________________________________
> 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
Emeritus Professor of Applied Statistics, University of Oxford



[Rd] valgrind false positive on R startup?
Prof Brian Ripley