From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32240 invoked by alias); 2 Aug 2014 22:55:08 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 32218 invoked by uid 48); 2 Aug 2014 22:55:04 -0000 From: "jannis at teunissen dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/62000] New: Program hangs on print *, func() statement. Date: Sat, 02 Aug 2014 22:55:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.9.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: jannis at teunissen dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-08/txt/msg00129.txt.bz2 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