From ripley at stats.ox.ac.uk  Wed Nov 27 20:24:53 2013
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 27 Nov 2013 19:24:53 +0000
Subject: [Rd] Checking packages with address sanitizer
In-Reply-To: <E078285E-D3B9-4732-BB27-203EBFFFD7DF@r-project.org>
References: <1385573804289-4681279.post@n4.nabble.com>
	<E078285E-D3B9-4732-BB27-203EBFFFD7DF@r-project.org>
Message-ID: <52964705.8060400@stats.ox.ac.uk>

On 27/11/2013 18:45, Simon Urbanek wrote:
>
> On Nov 27, 2013, at 12:36 PM, wokai <wolfgang.kaisers at gmail.com> wrote:
>
>> I was recently challenged to correct my package source (rbamtools) because
>> there were issues reported by address sanitizer.
>> Therefore the problem of installing and running instrumented (R +) package
>> code arises.
>>
>> Regrettably up to now, I found no way to use the address sanitizer, neither
>> for a small C-example nor for a new compiled version of R.
>> I get missing `__asan_report_store4' or `__asan_report_load4' messages.
>>
>> I'm working on Ubuntu 13.10 and tried gcc (4.8.1) and clang (3.2-7ubuntu1,
>> based on LLVM 3.2).
>>
>> Does anyone have experiance with address sanitizer (especially with a self
>> compiled R-version which is not in the standard location on the system)?
>>
>
> You have to compile *both* R and the package using AS flags. In fact, if you setup SA for R it will automatically work for packages. The above seems like you're trying to use AS just for the package, but that cannot work, because it's missing all the AS runtime libraries which must be in the main executable -- i.e. R.

Actually, it may work (does in gcc 4.8.2 for example), if you *link* the 
package with -faddress=sanitize.

See the current 'Writing R Examples' manual.

> Cheers,
> Simon
>
>
>
>
>> Thanks in advance
>> Wolfgang

-- 
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] Checking packages with address sanitizer
Prof Brian Ripley