[R] Mysterious seg fault --- SOLVED
pd@|gd @end|ng |rom gm@||@com
Mon Aug 13 13:39:30 CEST 2018
It's odd, possibly a bug, that you don't get
Error: object 'nphi' not found
but I can't offhand see where the evaluation of args to .C/.Fortran is supposed to take place.
> On 13 Aug 2018, at 11:54 , Rolf Turner <r.turner using auckland.ac.nz> wrote:
> On 13/08/18 20:45, Henrik Bengtsson wrote:
>> On Mon, Aug 13, 2018 at 3:51 AM Rolf Turner <r.turner using auckland.ac.nz> wrote:
>>> OK everybody! You can relax. :-) I managed to spot the loony. After
>>> mucking around with valgrind, and before trying gdb, I had one more look
>>> at my code and *finally* saw the stupid thing that I had been doing.
>>> In the call to .Fortran() I had a line
>>> but "nphi" was nowhere defined (!!!) in the R code. The name "nphi"
>>> appeared as an argument in the Fortran subroutine in question, but was
>>> nowhere actually *used*!!!
>> Didn't R CMD check pick this up, that is, didn't it report that 'nphi'
>> is a "global" variable?
> No it didn't. The name only appears in the call to .Fortran(). I think if it appeared in a call to an ordinary garden-variety R function then a warning would have been issued.
> Such a lapse would be hard for R CMD check to pick up. E.g
> would be OK in a call to .Fortran (which would allow a value of nphi, calculated within the called subroutine, to be *returned*) whereas
> causes trouble when nphi has never been defined (as I found out after a great expenditure of time and torn-out hair). In the former instance it doesn't matter an FTCF whether nphi has been defined or not.
> Technical Editor ANZJS
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Office: A 4.23
Email: pd.mes using cbs.dk Priv: PDalgd using gmail.com
More information about the R-help