Hi all,
I'm using the GNU compiler (gfortran) with the debugging options -finit-real=snan and -ffpe-trap=invalid. For a program with any real function that is using a separate result/return value (see example below) I get a floating-point exception (erroneous arithmetic operation). I don't understand why this is or how I could resolve the issue.
Thank you for any help.
Example code:
I'm using the GNU compiler (gfortran) with the debugging options -finit-real=snan and -ffpe-trap=invalid. For a program with any real function that is using a separate result/return value (see example below) I get a floating-point exception (erroneous arithmetic operation). I don't understand why this is or how I could resolve the issue.
Thank you for any help.
Example code:
Code:
program main
implicit none
print *, real_function() ! this works
print *, real_function_res() ! raises the exception
print *, rec_real_function() ! raises the exception
contains
real function real_function()
real_function = 3.
end function real_function
real function real_function_res() result(retval)
retval = 3.
end function real_function_res
recursive real function rec_real_function() result(retval)
retval = 3.
end function rec_real_function
end program main