public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug fortran/51286] New: function with print statement hangs when called as argument of a print statement @ 2011-11-23 18:06 stefano.borini at ferrara dot linux.it 2011-11-23 18:41 ` [Bug fortran/51286] " kargl at gcc dot gnu.org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: stefano.borini at ferrara dot linux.it @ 2011-11-23 18:06 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51286 Bug #: 51286 Summary: function with print statement hangs when called as argument of a print statement Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: stefano.borini@ferrara.linux.it This code hangs due to the "whatever" printing statement inside the function, when called as an argument to print. Wild guess is that it tries to get some lock during the Squared print, which is already taken by the caller, but it's pure speculation. Tested on ifort, works as expected (no hang, two prints). module Moo contains subroutine main() print *, Squared(5) end subroutine function Squared(v) integer, intent(in) :: v integer :: Squared Squared = v*v print *, "whatever" end function end module program foo use Moo call main() end program ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/51286] function with print statement hangs when called as argument of a print statement 2011-11-23 18:06 [Bug fortran/51286] New: function with print statement hangs when called as argument of a print statement stefano.borini at ferrara dot linux.it @ 2011-11-23 18:41 ` kargl at gcc dot gnu.org 2011-11-23 18:47 ` dominiq at lps dot ens.fr 2013-02-27 18:19 ` dominiq at lps dot ens.fr 2 siblings, 0 replies; 4+ messages in thread From: kargl at gcc dot gnu.org @ 2011-11-23 18:41 UTC (permalink / raw) To: gcc-bugs 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. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/51286] function with print statement hangs when called as argument of a print statement 2011-11-23 18:06 [Bug fortran/51286] New: function with print statement hangs when called as argument of a print statement stefano.borini at ferrara dot linux.it 2011-11-23 18:41 ` [Bug fortran/51286] " kargl at gcc dot gnu.org @ 2011-11-23 18:47 ` dominiq at lps dot ens.fr 2013-02-27 18:19 ` dominiq at lps dot ens.fr 2 siblings, 0 replies; 4+ messages in thread From: dominiq at lps dot ens.fr @ 2011-11-23 18:47 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51286 --- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-11-23 18:26:41 UTC --- Aren't you using some Mac OSX? If so, it is a duplicate of pr30617. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/51286] function with print statement hangs when called as argument of a print statement 2011-11-23 18:06 [Bug fortran/51286] New: function with print statement hangs when called as argument of a print statement stefano.borini at ferrara dot linux.it 2011-11-23 18:41 ` [Bug fortran/51286] " kargl at gcc dot gnu.org 2011-11-23 18:47 ` dominiq at lps dot ens.fr @ 2013-02-27 18:19 ` dominiq at lps dot ens.fr 2 siblings, 0 replies; 4+ messages in thread From: dominiq at lps dot ens.fr @ 2013-02-27 18:19 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51286 Dominique d'Humieres <dominiq at lps dot ens.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |DUPLICATE --- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-02-27 18:18:37 UTC --- > Aren't you using some Mac OSX? If so, it is a duplicate of pr30617. No answer, so closing as duplicate. *** This bug has been marked as a duplicate of bug 30617 *** ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-02-27 18:19 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-11-23 18:06 [Bug fortran/51286] New: function with print statement hangs when called as argument of a print statement stefano.borini at ferrara dot linux.it 2011-11-23 18:41 ` [Bug fortran/51286] " kargl at gcc dot gnu.org 2011-11-23 18:47 ` dominiq at lps dot ens.fr 2013-02-27 18:19 ` dominiq at lps dot ens.fr
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).