[R-SIG-Mac] gfortran bug?

Berend Hasselman bhh at xs4all.nl
Tue Apr 27 20:43:47 CEST 2010


On 27-04-2010, at 20:28, Andreas Noack Jensen wrote:

> Thank you so much for looking at it. Initially my code was in the "free"
> F95 format but partly because of the error and partly because of portability
> concerns I chose to translate it to strict F77 even thought it is ugly and
> annoying with the line width limit.
> 
> Indeed I think something is going wrong with the initial values but I cannot
> figure out why. Maybe because of missing Fortran skills but I am puzzled
> because the code works fine on Windows and Linux.
> 

Indeed, that is what I have found. See below.

> I think the "-mtune=core2" problem has disappeared in the latest 4.2.3
> gfortran at r.research because I had the error in the beginning but after
> reinstall of gfortran it was gone (right now, however,  I am on gfortran
> 4.2.4 aka gcc 4.2.1).
> 
> Thank you once again and hope some new ideas to isolate the problem will
> appear.


The error is in the fortran line

     double precision, intent(in) :: coef(ndim(1),ndim(2),ndim(3)),   init(ndim(3),ndim(nl(2)))

The dimensions of init are wrong.
The line should read:

     double precision, intent(in) :: coef(ndim(1),ndim(2),ndim(3)),   init(ndim(3),nl(2))

I have attached the corrected rmfilter.f90, a slightly modified rmfilter.R that I used to print various stuff
the test1.R and the output.

In the test case your code declares init(2,2)
In the corrected code it is declared as init(2,3)
The actual dimension is init(2,3)

Berend


-------------- next part --------------
A non-text attachment was scrubbed...
Name: rmfilter.f90
Type: application/octet-stream
Size: 994 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20100427/8b2bf75f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test1.R
Type: application/octet-stream
Size: 157 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20100427/8b2bf75f/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rmfilter.R
Type: application/octet-stream
Size: 984 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20100427/8b2bf75f/attachment-0002.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test1.Rout.txt
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20100427/8b2bf75f/attachment.txt>
-------------- next part --------------




More information about the R-SIG-Mac mailing list