[patch, libgfortran] PR65089 FAIL: gfortran.dg/io_real_boz(2|_[45]).f90 when tested with -fsanitize=address

Jerry DeLisle jvdelisle@charter.net
Sun Apr 12 21:54:00 GMT 2015


Hi all,

The attached patch fixes this bug.  It also eliminates non-freed memory whenever
a format error occurs.  Particular important when the user has use IOSTAT and 
generate_error does not exit, but returns to continue program execution.

Regression tested on x86-64 and tested with -fsanitize=address and valgrind on a 
number of existing test cases.  Changelog is fairly clear I think.

OK for trunk?

Regards,

Jerry

2015-04-12 Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/65089
	* io/format.h (free_format): New function to free memory
	allocated for building format error messages.
	* io/format.c (format_error): Add checks before freeing memory
	to avoid potential segfaults and free formatting data when
	needed on error conditions. Always allocate and NULL terminate
	the string.
	* io/transfer.c (st_read_done, st_write_done): Use new
	free_format function to clean up memory allocations when done.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr65089.diff
Type: text/x-patch
Size: 3932 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20150412/78733a70/attachment.bin>


More information about the Fortran mailing list