Found using valgrind: gfortran gfortran.dg/backspace_5.f valgrind ./a.out ==15340== Syscall param write(buf) points to uninitialised byte(s) ==15340== at 0x56000C0: __write_nocancel (in /lib64/libc-2.5.so) ==15340== by 0x4EBEE90: do_write (unix.c:336) ==15340== by 0x4EBEF31: fd_flush (unix.c:386) ==15340== by 0x4EBCBF6: _gfortran_st_write_done (transfer.c:2762) ==15340== by 0x400BAB: MAIN__ (in /projects/tob/gcc/gcc/testsuite/gfortran.dg/a.out) ==15340== by 0x40104B: main (fmain.c:22) Similarly for: - backspace_6.f - write_back.f - write_rewind_1.f - write_rewind_2.f - char_bounds_check_fail_1.f90 - direct_io_2.f90 - unf_io_convert_3.f90
This is a bug in the test case. I'll commit a correct version. Thomas
Created attachment 13279 [details] patch for the test cases All but one of these were errors in the test cases, which are corrected with this patch. unf_io_convert_3.f90 is a case where we don't initialize the left-over bytes when converting. Hmm... I'll have to look into this some more.
Created attachment 13280 [details] proposed patch This one also fixes the last case. It does so by reading size bytes instead of the kind number when converting endianness. This makes the buffers initialized, and also makes sure the number of bytes are the same when using CONVERT="SWAP" or when using the native format. Not that I really expect anybody to use CONVERT with 10-byte reals, anyway :-)
Subject: Bug 31297 Author: tkoenig Date: Sun Mar 25 21:17:51 2007 New Revision: 123200 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123200 Log: 2007-03-25 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/31297 * gfortran.dg/backspace_5.f: Initialize variable(s). * gfortran.dg/backspace_6.f: Likewise. * gfortran.dg/char_bounds_check_fail_1: Likewise. * gfortran.dg/direct_io_2.f90: Likewise. * gfortran.dg/write_back.f: Likewise. * gfortran.dg/write_rewind_2.f: Likewise. * gfortran.dg/write_rewind_1.f: Likewise. * gfortran.dg/write_rewind_2.f: Likewise. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/backspace_5.f trunk/gcc/testsuite/gfortran.dg/backspace_6.f trunk/gcc/testsuite/gfortran.dg/char_bounds_check_fail_1.f90 trunk/gcc/testsuite/gfortran.dg/direct_io_2.f90 trunk/gcc/testsuite/gfortran.dg/write_back.f trunk/gcc/testsuite/gfortran.dg/write_rewind_1.f trunk/gcc/testsuite/gfortran.dg/write_rewind_2.f
I think this can be closed. No need to backport. RE-open if anyone disagrees.
Hi Jerry, there is still the issue with kind=10 reals written with CONVERT="swap". Reopening until we've decided what to do with that :-) Thomas
Seems unf_io_convert_3.f90 is fixed by the patch for PR31915, which adds padding for CONVERT. The patch was committed as r124741. Closing, please verify and reopen if I'm wrong.