[Rd] gcc ubsan alignement test --minimal gcc version?

kaveh vakili.kaveh.email at gmail.com
Wed Oct 14 10:36:16 CEST 2015


Dear Prof. Ripley,

Thank you for your answer. I think I am way over my head here.

(Using Doker adds a level of complexity that I'm afraid I can't
manage for now so I am happy with building Rdevel and using it
in to run these tests).

After building Rdevel with what I think are the correct options**
  (just to avoid mistakes I have also fully removed R from my system
  just before and insured that the following packages are all updated)

apt-get install bash-completion bison debhelper default-jdk g++ gcc 
gfortran groff-base libblas-dev libbz2-dev libcairo2-dev 
libcurl4-openssl-dev libjpeg-dev liblapack-dev liblzma-dev 
libncurses5-dev libpango1.0-dev libpcre3-dev libpng-dev libreadline-dev 
libtiff5-dev libx11-dev libxt-dev mpack subversion tcl8.5-dev texinfo 
texlive-base texlive-extra-utils texlive-fonts-extra 
texlive-fonts-recommended texlive-generic-recommended texlive-latex-base 
texlive-latex-extra texlive-latex-recommended tk8.5-dev valgrind 
x11proto-core-dev xauth xdg-utils xfonts-base xvfb zlib1g-dev

cd /tmp
svn co http://svn.r-project.org/R/trunk R-devel
cd /tmp/R-devel
R_PAPERSIZE=letter R_BATCHSAVE="--no-save --no-restore" 
PAGER=/usr/bin/pager  PERL=/usr/bin/perl  R_UNZIPCMD=/usr/bin/unzip 
R_ZIPCMD=/usr/bin/zip  R_PRINTCMD=/usr/bin/lpr  LIBnn=lib 
AWK=/usr/bin/awk  CFLAGS="-pipe -std=gnu99 -Wall -pedantic -O2" 
CXXFLAGS="-pipe -Wall -pedantic -O2"  CC="gcc 
-fsanitize=address,undefined"  CXX="g++ -fsanitize=address,undefined"  
CXX1X="g++ -fsanitize=address,undefined"  FC="gfortran 
-fsanitize=address,undefined"  F77="gfortran 
-fsanitize=address,undefined" ./configure --enable-R-shlib 
--without-blas --without-lapack --with-readline 
--without-recommended-packages --program-suffix=dev --disable-openmp
make
make install
make clean

But I'm not sure how to proceed from there.
I tried the obvious thing:

Rdevel CMD build my_offending_package
Rdevel CMD check --as-cran my_offending_package

But I have not been able to replicate the bug I see on cran:

/usr/local/gcc5/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/emmintrin.h:140:21: runtime error: load of misaligned address 0x61800007fc84 for type 'const double', which requires 8 byte alignment
0x61800007fc84: note: pointer points here
   00 00 80 3f 00 00 80 3f  00 00 80 3f 00 00 80 3f  00 00 80 3f 00 00 80 3f  00 00 80 3f 00 00 80 3f


**Though the original authors bear no responsibility for these scripts,
  I have found many of these commands on this file:
https://github.com/rocker-org/r-devel-san/blob/master/Dockerfile





On 2015-10-14 10:10, Prof Brian Ripley wrote:
> On 13/10/2015 14:46, kaveh wrote:
>>    Dear All,
>>
>>    I'm trying to implement the section of the manual pertaining to the
>> gcc-ubsan test
>>    carried by CRAN on my local computer (ubuntu 14.04):
>>
>> http://www.stats.ox.ac.uk/pub/bdr/memtests/gcc-UBSAN/README.txt
>>
>>    I was wondering whether someone could tell what the minimal version
>>     of the gcc tool chain needed to run the gcc-ASAN and gcc-UBSAN
>> alignment
>>    tests on ones local computer is. CRAN seems to use gcc 5.2.0 to do
>> these tests,
>>     but the current version of gcc shipped with ubuntu is 4.9.2 (to be
>> updated to
>>     5.1.0 with the 15.10 release latter this month).
>>
>>   I hope this is the correct list to post this.
>
> The correct thing to do is to read the manual (either the R manual or 
> your gcc manual).  The R manual says
>
> 'AddressSanitizer (‘ASan’) is a tool with similar aims to the memory 
> checker in valgrind. It is available with suitable builds of gcc 4.8.0 
> or clang 3.1 and later on common Linux and OS X platforms.'
>
> '‘UBSanitizer’ is a tool for C/C++ source code selected by 
> -fsanitize=undefined in suitable builds of clang, and GCC as from 4.9.0.'
>
> Note that including these capabilities and their runtimes is optional 
> at least for clang (until recently Apple omitted them), so you need to 
> check your own system's documentation.
>



More information about the R-devel mailing list