No output from print statements in Fortran

12,840

In the comments it turned out that there was a problem with buffering of the output stream. This can be controled by calling the flush statement, the non-standard flush() intrinsic subroutine or by compiler-specific environment variables like GFORTRAN_UNBUFFERED_ALL.

Share:
12,840
hatmatrix
Author by

hatmatrix

Updated on June 04, 2022

Comments

  • hatmatrix
    hatmatrix over 1 year

    I have compiled a program to execute sequentially (not parallel) in fortran 90. I am trying to debug the program with print statements to check my rusty gdb fu. I am compiling the files with gfortran -c -O2 -ffast-math -ggdb. However, none of these statements print anything:

    print *, variablename1, variablename2
    write(6,*) variablename1, variablename2
    write(*,*) variablename1, variablename2
    

    The compiled program prints nothing and executes as if the statements are not there. Could I be missing something simple and obvious?