This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/51286] function with print statement hangs when called as argument of a print statement
- From: "kargl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 23 Nov 2011 18:06:09 +0000
- Subject: [Bug fortran/51286] function with print statement hangs when called as argument of a print statement
- Auto-submitted: auto-generated
- References: <bug-51286-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51286
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #1 from kargl at gcc dot gnu.org 2011-11-23 18:06:09 UTC ---
Your code is invalid, because it is doing trying to do
recursive IO. From the Fortran 2003 standard:
An input/output statement that is executed while another
input/output statement is being executed is called a
recursive input/output statement.
A recursive input/output statement shall not identify an
external unit except that a child data transfer statement
may identify its parent data transfer statement external unit.
A data transfer statement that includes a derived-type
list item and that causes a user-defined derived-type
input/output procedure to be invoked is called a parent
data transfer statement. A data transfer statement that
is executed while a parent data transfer statement is being
processed and that specifies the unit passed into a
user-defined derived-type input/output procedure is called
a child data transfer statement.
You are invoking undefined behavior, and are clearly
getting an acceptable result.