This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/51286] function with print statement hangs when called as argument of a print statement


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]