[Bug fortran/51286] New: function with print statement hangs when called as argument of a print statement
stefano.borini at ferrara dot linux.it
gcc-bugzilla@gcc.gnu.org
Wed Nov 23 18:06:00 GMT 2011
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
More information about the Gcc-bugs
mailing list