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

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).