Failure of implicit real*8

Steve Kargl sgk@troutmask.apl.washington.edu
Sun Feb 20 03:37:00 GMT 2011


On Sun, Feb 20, 2011 at 03:22:28AM +0000, Michael D. Berger wrote:
> On Sat, 19 Feb 2011 19:04:25 -0800, Steve Kargl wrote:
> 
> > On Sun, Feb 20, 2011 at 02:48:59AM +0000, Michael D. Berger wrote:
> >> On Sat, 19 Feb 2011 18:22:57 -0800, Steve Kargl wrote:
> >> 
> >> > On Sun, Feb 20, 2011 at 02:13:35AM +0000, Michael D. Berger wrote:
> >> [...]
> [...]
> 
> > Sigh, we need the entire specification portion of the actual code.  You
> > showed us
> > 
> >    subroutine orderRows(mx, idxSort, nrows, ncols)
> >    dimension idxSort(nrows),mx(nrows,ncols),tmp(nrows,ncols)

Does it work if you add
 
       real mx, tmp

before the dimension statement?

>       do 20 ii = 1,nrows
>          kk = idxSort(ii)
>          do 21 jj = 1,ncols
> 21          tmp(ii,jj) = mx(kk,jj)
> 20    continue
> 
>       do 22 ii = 1,nrows
>          do 23 jj = 1,ncols
> 23          mx(ii,jj) = tmp(ii,jj)
> 22    continue
> 
>       return
>       end
> 
> Here is the rest of the subroutine.  What do you think?  BTW, I
> printed idxSort -- it's ok.
> 
> > Well, in the above mx has the type INTEGER from the implicit typing
> > rules.
> 
> Yes, I neglected that.  Surprising that one of the routines works at all!
> 

I would suggest adding 'implicit none' to all your 
routines and explicitly declaring all your variables.

-- 
Steve



More information about the Fortran mailing list