[patch, libgfortran] PR32752 Segfault on WRITE with modified unix_stream structure
Jerry DeLisle
jvdelisle@verizon.net
Sat Jul 14 16:27:00 GMT 2007
:ADDPATCH fortran:
Hi Folks,
This one was ugly and difficult. The final fix appears straightforward, but it
was hard to find this stealthy bug.
The problem was off by one errors that tended to cancel coupled with stream I/O
not setting a variable correctly. This failure was only seen when I moved the
location of the buffer pointer within the unix_stream structure. The failure
showed only with streamio_3.f90.
Fully regression tested on x86-64-Gnu/Linux. I also did some valgrind checks on
streamio_3.f90 and those showed very clean.
No new test case is needed.
OK for trunk?
Regards,
Jerry
2007-07-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/32752
* io/unix.c (unix_stream): Move buffer pointer adjacent to small_buffer.
* io/transfer.c (formatted_transfer_scalar): If stream I/O, set
bytes_used to zero. Fix off by one error in calculation of pos and
skips. Eliminate duplicate pending_spaces check.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr32752-2.diff
Type: text/x-patch
Size: 2212 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070714/e10f153a/attachment.bin>
More information about the Fortran
mailing list