I used to put some "write(*,*)" in my code when I want quick and easy checks of what is happening.
Today I encountered an error while doing this with ifort :
Here the sample program :
program test implicit none write(*,*) func(),func() contains function func() real(8) :: func func=0.d0 write(*,*) "Inside func" end function func
And the output:
forrtl: severe (40): recursive I/O operation, unit -1, file unknown
I guess, someway the compiler get lost with a write to * inside a write to *.
Indeed if I change write(*,*) "Inside func" to write(6,*) "Inside func" (6 being preconnected to the default output), the error disappears.
write(*,*) func() write(*,*) func()
in the main part is ok too.
Am I missing something in write mechanism that should forbide me to use it this way ?
Gfortran compile and execute without error the code.
Ifort version 14.0.2