Dear Mat,
We have identified the source of the error (the program works with -g). The
cause is the value of an interger index, which is overwritten on the second
call to a subroutine by a meaningless value. The subroutine apparently
accesses memory bejond its allowed range when called a second time!
The integer index was passed to the subroutine as an additional parameter
to allow its value to be printed. The principal code structure is:
subroutine amix(…, t, n, …, index)
integer n, index
double precision t(n), temp1, temp2
…
do i = 1, n ! n = 1 here
…
temp1 = …
temp2 = …
…
print *, index ! value OK
t(i) = temp2 - temp1
print *, index ! meanigless value on second call
…
end do
…
end subroutine amix
The first call to amix leaves ‘index’ unchanged, the second call changes ‘index’ to
something meaningless (e.g. a large negative integer) which causes the program
to seg fault, when ‘index’ used to address another array. Apart from the ‘print’
statements the subroutine does not access ‘index’ and therefore index is normally
omitted from the parameter list. Nonetheless ‘index’ is corrupted after the second
call to the subroutine.
For me this seems to point to a compiler problem on 64 bit opteron systems.
Best regards,
Michael