[patcg, fortran] PR30200 write(*,myfmt="(1X,a,'xyz')") "A" prints Az' instead of Axyz

Jerry DeLisle jvdelisle@verizon.net
Fri Dec 15 08:44:00 GMT 2006


:ADDPATCH fortran:

The following simple patch fixes this problem by moving the freeing of memory 
holding the format string to after the transfer operations are complete.  This 
clears up all the valgrind errors reported and gives clean output.

Regression tested on x86-64-linux.  Test case attached.

I will commit under obvious and simple rule to trunk and then to 4.2 branch in a 
day.

Regards,

Jerry

2006-12-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/30200
	* trans-io.c (build_dt): Move post block for format_expr to end.


and the patch:

Index: trans-io.c
===================================================================
*** trans-io.c  (revision 119608)
--- trans-io.c  (working copy)
*************** build_dt (tree function, gfc_code * code
*** 1430,1436 ****
                             dt->advance);

         if (dt->format_expr)
!       mask |= set_string (&block, &post_block, var, IOPARM_dt_format,
                             dt->format_expr);

         if (dt->format_label)
--- 1430,1436 ----
                             dt->advance);

         if (dt->format_expr)
!       mask |= set_string (&block, &post_end_block, var, IOPARM_dt_format,
                             dt->format_expr);

         if (dt->format_label)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: write_fmt_trim.f90
Type: text/x-fortran
Size: 320 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061215/9eef9dfd/attachment.bin>


More information about the Gcc-patches mailing list