Subject: Fortran problem
To: None <current-users@NetBSD.ORG>
From: Patrick Welche <email@example.com>
Date: 06/05/1998 17:34:02
I have just encountered an odd fortran problem. The program works fine
under osf1, and the point where it all goes horribly wrong seems too
simple to have an error. Where does one take up problems that seem to
be related to g77?
For the curious the problem is:
Program terminated with signal 11, Segmentation fault.
1218 zi(k,j) = -zr(k,j) * tau(2,k)
(gdb) whatis zi
type = PTR TO -> ( real*8 (-1,-1))
Current language: auto; currently fortran
(gdb) print nm
$1 = (PTR TO -> ( integer )) 0xefbf1b78
(gdb) print *nm
$2 = 486
(gdb) print *m
$3 = 480
(gdb) print *n
$4 = 480
(gdb) print *k
$5 = 12385
Yet the code says:
double precision ar(nm,n),ai(nm,n),tau(2,n),zr(nm,m),zi(nm,m)
if (m .eq. 0) go to 200
c .......... transform the eigenvectors of the real symmetric
c tridiagonal matrix to those of the hermitian
c tridiagonal matrix. ..........
do 50 k = 1, n
do 50 j = 1, m
zi(k,j) = -zr(k,j) * tau(2,k)
zr(k,j) = zr(k,j) * tau(1,k)
Nothing has been cut between "50" and "subroutine".
So the question is: how did k manage to become greater than n?
And to make matters worse... when this piece of code is cut out and
placed into a tiny test program it works.
% f77 -v
Using builtin specs.
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)