I have this simple Fortran code and a function which I explicitly supply with an argument in the main program. The code is below:
implicit none
real*8 rrr,x
external tttt
x = rrr(10)
end
function rrr(seed)
integer seed, k
real*8 rrr
k = 7
seed = 16807 * ( seed - k * 127773 ) - (k * 2836)
print*,seed
rrr = seed / 2.
end
It compiles, however upon run it produces the following error:
Program received signal SIGBUS: Access to an undefined portion of a memory object.
Backtrace for this error:
#0 0x10f43bfe6
#1 0x10f43b7ac
#2 0x7fff89740529
#3 0x10f433d78
#4 0x10f433e2c
#5 0x10f433e6e
Bus error: 10
Any ideas what maybe causing the error? I use gfortran to compile my code.