------- Comment #2 from kargl at gcc dot gnu dot org 2007-01-27 21:38 ------- (In reply to comment #1) > I believe recursive IO is undefined (except maybe in some very limited > situations), but I can't locate anything in the F95 Standard that says > this. :( >
Okay I found the relevant passage. 9.7 Restrictions on function references and list items A function reference shall not appear in an expression anywhere in an input/output statement if such a reference causes another input/output statement to be executed. I believe your "print *, fun()" is nonconforming. Note F2003 changes the restrictions of recursive IO. It may take a long time before gfortran supports this. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30617