From ripley at stats.ox.ac.uk  Sun Aug 28 08:20:44 2005
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sun, 28 Aug 2005 07:20:44 +0100 (BST)
Subject: [Rd] .Call and Segmentation Fault
In-Reply-To: <973080e10508271924266ea3bf@mail.gmail.com>
References: <973080e10508261519699235ea@mail.gmail.com>
	<F81375EB-3C7E-4385-ADC1-8842A449A332@stat.harvard.edu>
	<973080e10508271924266ea3bf@mail.gmail.com>
Message-ID: <Pine.LNX.4.61.0508280718090.3599@gannet.stats>

On Sat, 27 Aug 2005, Ricardo Luiz Andrade Abrantes wrote:

> Hi!
> Yes, I am returning a SEXP from the functions called from R, and the
> problem occurs before (thousands of iterations before) the return
> point.
> In fact I runned valgrind into R and when I call ".Call(...) " I got
> many errors like:
> ==4324== Use of uninitialised value of size 8
> ==4324==    at 0x1CB0766D: tnls_ (gencan.f:4101)
> ==4324==    by 0x1CB01962: gencan_ (gencan.f:1876)
> ==4324==    by 0x1CAFECA5: easygencan_ (gencan.f:440)
> ==4324==    by 0x1CB0B47D: algencan_ (algencan.f:517)
> ==4324==    by 0x1CB09E74: easyalgencan_ (algencan.f:76)
> ==4324==    by 0x1CAFE5B3: main (algencanma.c:808)
> what does not happens when I compile the algencanma as a regular
> program (not a library) and run it from shell. Valgrind does not find
> anything wrong when I run the program directly, except 2 missing
> free() calls.
> Do you have any ideas where the problem lies (R .Call function or C program)?

It cannot be .Call: your .Call passed no parameters so there was nothing 
to be uninitialized.  I did ask you why you were doing that.

.Call is very heavily tested in lots of R applications, so the prior 
probability of innocence must be very high.

-- 
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] .Call and Segmentation Fault
Prof Brian Ripley