]> git.ipfire.org Git - thirdparty/gcc.git/commit
testsuite/gfortran.dg/unsigned_22.f90: Add missing close with delete, PR116701
authorHans-Peter Nilsson <hp@axis.com>
Mon, 23 Sep 2024 01:29:02 +0000 (03:29 +0200)
committerHans-Peter Nilsson <hp@bitrange.com>
Mon, 23 Sep 2024 01:40:41 +0000 (03:40 +0200)
commit3f37c6f47cd50c99350e93ef0dab31f7dc6d213a
treef3618b5a7c40cbada3e13e1df13d7fddd1b41ba7
parentca12354fe2e22e9819a25a0b60d04c53a53f9fc3
testsuite/gfortran.dg/unsigned_22.f90: Add missing close with delete, PR116701

Without this patch, gfortran.dg/unsigned_22.f90 fails for
non-effective-target fd_truncate targets, i.e. targets that
don't support chsize or ftruncate.  See also
libgfortran/io/unix.c:raw_truncate.  It passes on the first
run, but leaves behind a file "fort.10" which is then picked
up by subsequent runs, but since that file is to be
rewritten, the libgfortran machinery tries to truncate it,
which fails.  The file always being left behind, is
primarily because the test-case lacks a deleting
close-statement, apparently accidentally.

Incidentally, this "fort.10" artefact is also picked up by
gfortran.dg/write_check3.f90 causing that test to fail too,
observable as a regression for non-fd_truncate targets since
the unsigned_22.f90 introduction.  Also, when running
e.g. the whole of gfortran.dg/dg.exp, the "fort.10" is later
deleted by gfortran.dg/write_direct_eor.f90 (which
regardlessly passes), erasing the clue of the cause of the
write_check3 failure.  Also, running just
dg.exp=write_check3.f90 or manually repeating the commands
in gfortran.log showed no error.

N.B.: this close-statement will not help if unsigned_22 for
some reason fails, executing one of the "stop" statements,
but that's also the case for many other tests.

PR testsuite/116701
* gfortran.dg/unsigned_22.f90: Add missing close with delete.
gcc/testsuite/gfortran.dg/unsigned_22.f90