pgfortran message formatting bug

I have encountered a very odd problem with formatted output of a real*8 value in a F77 program. The minimal code below reproduces the issue with PGI 18.4.

       program format_test
       integer imax,i
       real*8 time,dt
       imax = 4
       time = 9.98
       dt = 0.01
       do i=1,imax
        time = time + dt
        write(*,1000) time
 1000  format(G12.5)

If I compile and run this with gfortran I observe the expected output, but with pgfortran I see the output below (note the missing zero in 10.000).

  • 9.9900
    1 .000

Switching the format code from G12.5 to F12.5 seems like an OK workaround for now. I think this is a bug, but perhaps I am missing something. Thanks for your advice and help.

Thanks David. I was able to reproduce the error and have added TPR#26053. The looks to have first begun in the 17.7 compilers.


Thanks Mat for the quick resopnse, and thanks for the TPR number. I’ll keep an eye out so we can update our compiler when a fix is ready.


Sorry for the delay. This was fixed in PGI 18.7.