missing output
Damian Rouson
damian@sourceryinstitute.org
Wed Dec 11 06:31:00 GMT 2019
Gfortran developers,
I am contributing to an open-source project with about 90K lines of Fortran
code and am curious if anyone can offer some perspective on a particularly
perplexing heisenbug. It would be challenging to produce a reduced case so
I haven't submitted a bug report. I get the following behavior with
gfortran 8.3.1, 9.2.0, and the trunk.
At the following line is a WRITE to OUTPUT_UNIT:
https://github.com/radiasoft/zgoubi/blob/single-image-writes/utilities/data-partition-impl.f90#L92
immediately followed by a FLUSH and then a currently commented conditional
STOP that halts execution on the second pass through the encompassing
subroutine. Without the stop statement, the second pass through the
subroutine produces no output even though previous and subsequent passes
produce output. Any thoughts on what might cause this?
Zaak Beekman (cc'd) has mentioned seeing such behavior in which gfortran
seems to optimize away certain output. He has found that putting the
output in a character variable (presumably by internal file I/O) first and
then writing it fixes the problem. That didn't work in this case and I see
this problem even with -O0 so I assume it's not related to optimization.
I don't expect that anyone will attempt to build and run this code, but if
anyone so desires, please let me know so that I can explain how to find and
execute the relevant test case.
Damian
More information about the Fortran
mailing list