Re: [Rd] gfortran optimization problems

From: Simone Giannerini <sgiannerini_at_gmail.com>
Date: Sat, 25 Oct 2008 12:04:05 +0200

Dave,

yes, we have experienced different results in different platforms, the problem was partly due to the different versions of gfortran installed across platforms, are you using the same version for all the platforms?
Clearly, gfortran is undergoing rapid changes so that the results might vary a lot across versions. You might want to contact the developers should you find out a compiler bug.

Kind regards

Simone

On Sat, Oct 25, 2008 at 12:53 AM, Dave Roberts <droberts_at_montana.edu> wrote:

> Colleagues,
>
> I have a routine in package labdsv that calls a FORTRAN subroutine.
> Recently, I was informed that it sometimes gives different results on a PC
> and Mac, and that the PC version is clearly wrong. I tested it on linux
> (because I don't have a PC), and I get the same (incorrect) behavior as the
> PC.
>
> Simply by inserting debug WRITE statements in the FORTRAN I would get
> different, and correct, results, so I assumed it was an optimization error.
>
> So,
>
> 1) R CMD SHLIB duleg.f does not work, and produces bogus code
>
> however,
>
> 2) gfortran -c alt_duleg.f
> gcc -O -std=gnu99 -shared -L/usr/local/lib -o alt_duleg.so
> alt_duleg.o -lgfortran -lm -lgcc_s
>
> does work (note the -O low optimization). Otherwise the gcc command is
> identical to the one produced by R CMD SHLIB.
>
> Has anyone else seen this? Is there a simple way to have my package
> enforce no optimization so others don't struggle with this? As far as I
> know the same code worked under g77.
>
> Thanks, Dave Roberts
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> David W. Roberts office 406-994-4548
> Professor and Head FAX 406-994-3190
> Department of Ecology email droberts_at_montana.edu
> Montana State University
> Bozeman, MT 59717-3460
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
______________________________________________________

Simone Giannerini
Dipartimento di Scienze Statistiche "Paolo Fortunati"
Universita' di Bologna
Via delle belle arti 41 - 40126  Bologna,  ITALY
Tel: +39 051 2098262  Fax: +39 051 232153
http://www2.stat.unibo.it/giannerini/
______________________________________________________

	[[alternative HTML version deleted]]

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Sat 25 Oct 2008 - 10:17:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 25 Oct 2008 - 10:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive