https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62000

            Bug ID: 62000
           Summary: Program hangs on print *, func() statement.
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jannis at teunissen dot net

Code example:
---------------------------
program my_test
  use mpi
  implicit none

  integer :: ierr
  real    :: rr

  call MPI_init(ierr)
  call set_real(rr)
  print *, rr
  print *, get_real()
  call MPI_finalize(ierr)
contains
  real function get_real()
    print *, "FUNC"
    get_real = 1.0
  end function get_real
  subroutine set_real(arg)
    real, intent(out) :: arg
    print *, "SUB"
    arg = 1.0
  end subroutine set_real
end program my_test
---------------------------
Compilation: mpif90 (no flags)
Result:
$ ./a.out 
 SUB
   1.00000000
   ** program hangs indefinitely **

Same result with MPICH instead of OpenMPI (see below). Without MPI, the problem
goes away. If "print *, get_real()" is replaced by:

rr = get_real()
print *, rr

there is again no problem.


Open MPI: 1.6.5
GNU Fortran (Debian 4.9.1-1) 4.9.1
Linux debian 3.13-1-amd64 #1 SMP Debian 3.13.10-1 (2014-04-15) x86_64 GNU/Linux

Reply via email to