Steve Roberts
2004-Feb-11 11:30 UTC
[R] RGui (Windows) crashes after use of a Salford Fortran DLL
Anybody out there successfully using the Salford Fortran compilers with R? I have created a DLL using the Salford FTN95 compiler and it works in as far I can dyn.load it, run the routines and get the right answers back. Unfortunately subsequently, sometime later, the Rgui crashes (access violation I think from the DrWatson log). The crashes depend on whether or not I paste the code as one big chunk, or as little chunks, and sometimes I can do a few things before it crashes and other times not - but if I do exactly the same things the crashes are reproducible. The crashes are sometimes in the DLL and sometimes in pure R code. R1.7.1 and 1.8.1 seem to behave identically. Windows 2000 Pro. I do get the dyn.load warning about the DLL changing the FPU control word. Does this ring any bells with anyone? Steve. Dr Steve Roberts steve.roberts at man.ac.uk Senior Lecturer in Medical Statistics, CMMCH NHS Trust and University of Manchester Biostatistics Group, 0161 275 5192 / 0161 276 5785
Liaw, Andy
2004-Feb-11 13:01 UTC
[R] RGui (Windows) crashes after use of a Salford Fortran DLL
My suggestion would be to make sure that your code works with the recommended compilers, and that the problem is not in your code. (This is harder than you might think: I recently found a bug in a Fortran subroutine that crashes R _only_ if I use the latest GCC _and_ turn on optimization.) Andy> From: Steve Roberts > > Anybody out there successfully using the Salford Fortran compilers > with R? > > I have created a DLL using the Salford FTN95 compiler and it works > in as far I can dyn.load it, run the routines and get the right > answers back. Unfortunately subsequently, sometime later, the > Rgui crashes (access violation I think from the DrWatson log). The > crashes depend on whether or not I paste the code as one big > chunk, or as little chunks, and sometimes I can do a few things > before it crashes and other times not - but if I do exactly the same > things the crashes are reproducible. The crashes are sometimes in > the DLL and sometimes in pure R code. R1.7.1 and 1.8.1 seem to > behave identically. Windows 2000 Pro. > > I do get the dyn.load warning about the DLL changing the FPU > control word. > > Does this ring any bells with anyone? > > Steve. > > Dr Steve Roberts > steve.roberts at man.ac.uk > > Senior Lecturer in Medical Statistics, > CMMCH NHS Trust and University of Manchester Biostatistics Group, > 0161 275 5192 / 0161 276 5785 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > >------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments,...{{dropped}}
Uwe Ligges
2004-Feb-11 13:11 UTC
[R] RGui (Windows) crashes after use of a Salford Fortran DLL
Steve Roberts wrote:> Anybody out there successfully using the Salford Fortran compilers > with R? > > I have created a DLL using the Salford FTN95 compiler and it works > in as far I can dyn.load it, run the routines and get the right > answers back. Unfortunately subsequently, sometime later, the > Rgui crashes (access violation I think from the DrWatson log). The > crashes depend on whether or not I paste the code as one big > chunk, or as little chunks, and sometimes I can do a few things > before it crashes and other times not - but if I do exactly the same > things the crashes are reproducible. The crashes are sometimes in > the DLL and sometimes in pure R code. R1.7.1 and 1.8.1 seem to > behave identically. Windows 2000 Pro. > > I do get the dyn.load warning about the DLL changing the FPU > control word. > > Does this ring any bells with anyone?Duncan Murdoch has collected some notes on different compiler issues on Windows (don't know whether Salford FTN95 is among them). Nevertheless, it is recommended to use the MinGW port of the gcc compiler with R. Uwe Ligges> Steve. > > Dr Steve Roberts > steve.roberts at man.ac.uk > > Senior Lecturer in Medical Statistics, > CMMCH NHS Trust and University of Manchester Biostatistics Group, > 0161 275 5192 / 0161 276 5785 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Duncan Murdoch
2004-Feb-11 14:11 UTC
[R] RGui (Windows) crashes after use of a Salford Fortran DLL
On Wed, 11 Feb 2004 11:30:35 +0000, "Steve Roberts" <steve.roberts at man.ac.uk> wrote :>Anybody out there successfully using the Salford Fortran compilers >with R? > >I have created a DLL using the Salford FTN95 compiler and it works >in as far I can dyn.load it, run the routines and get the right >answers back. Unfortunately subsequently, sometime later, the >Rgui crashes (access violation I think from the DrWatson log). The >crashes depend on whether or not I paste the code as one big >chunk, or as little chunks, and sometimes I can do a few things >before it crashes and other times not - but if I do exactly the same >things the crashes are reproducible. The crashes are sometimes in >the DLL and sometimes in pure R code. R1.7.1 and 1.8.1 seem to >behave identically. Windows 2000 Pro. > >I do get the dyn.load warning about the DLL changing the FPU >control word. > >Does this ring any bells with anyone?A reproducible crash sometime later sounds to me like memory corruption. I'd guess the crash occurs at the next garbage collection; something has happened to mess up the internal memory structures, so R goes down. You can call gc() to trigger a garbage collection just after your call to your DLL; that's likely to trigger the crash if my guess is right. Fixing it will be harder: you need to find why your DLL is writing in someone else's memory space. Perhaps make your arrays larger than necessary, and check that values that weren't supposed to be touched stay untouched? Regarding the FPU control word: general instructions to fix this bug in your DLL are given on my web page <http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/>. If there's anything special about the Salford compiler that needs mentioning there, please write it up and send it to me. Duncan Murdoch