From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15513 invoked by alias); 3 Jun 2009 16:47:40 -0000 Received: (qmail 15458 invoked by uid 48); 3 Jun 2009 16:47:26 -0000 Date: Wed, 03 Jun 2009 16:47:00 -0000 Message-ID: <20090603164726.15457.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libfortran/40330] [4.4 Regression] incorrect IO In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jv244 at cam dot ac dot uk" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-06/txt/msg00140.txt.bz2 ------- Comment #5 from jv244 at cam dot ac dot uk 2009-06-03 16:47 ------- OK, now with easy testcase, as you'll notice from the output, the loop is important: IMPLICIT NONE character(len=100) :: fmt1,str1,fmt2,str2 real*8 :: r(3)=0 integer :: i,iunit fmt1="(T2,A2," str1="a" iunit=6 DO i=1,10 write(iunit,TRIM(fmt1)//"1X,3F20.10)") TRIM(str1),r(1:3) ENDDO END yields with 4.4.1 under valgrind : > gfortran test.f90 ; valgrind --tool=memcheck ./a.out a 0.0000000000 0.0000000000 0.0000000000 ==666== ==666== Invalid read of size 1 ==666== at 0x4A22DF9: strncmp (mc_replace_strmem.c:314) ==666== by 0x4BD83AF: _gfortrani_parse_format (format.c:188) ==666== by 0x4BE4B4F: data_transfer_init (transfer.c:2106) ==666== by 0x400C75: MAIN__ (in /data03/vondele/bug/io/a.out) ==666== by 0x400D89: main (fmain.c:21) ==666== Address 0x55d9218 is 0 bytes inside a block of size 1,152 free'd ==666== at 0x4A2196E: free (vg_replace_malloc.c:323) ==666== by 0x400D31: MAIN__ (in /data03/vondele/bug/io/a.out) ==666== by 0x400D89: main (fmain.c:21) ==666== ==666== Invalid read of size 1 ==666== at 0x4A22E06: strncmp (mc_replace_strmem.c:314) ==666== by 0x4BD83AF: _gfortrani_parse_format (format.c:188) ==666== by 0x4BE4B4F: data_transfer_init (transfer.c:2106) ==666== by 0x400C75: MAIN__ (in /data03/vondele/bug/io/a.out) ==666== by 0x400D89: main (fmain.c:21) ==666== Address 0x55d9218 is 0 bytes inside a block of size 1,152 free'd ==666== at 0x4A2196E: free (vg_replace_malloc.c:323) ==666== by 0x400D31: MAIN__ (in /data03/vondele/bug/io/a.out) ==666== by 0x400D89: main (fmain.c:21) ==666== ==666== Invalid read of size 1 ==666== at 0x4A22E16: strncmp (mc_replace_strmem.c:314) ==666== by 0x4BD83AF: _gfortrani_parse_format (format.c:188) ==666== by 0x4BE4B4F: data_transfer_init (transfer.c:2106) ==666== by 0x400C75: MAIN__ (in /data03/vondele/bug/io/a.out) ==666== by 0x400D89: main (fmain.c:21) ==666== Address 0x55d9219 is 1 bytes inside a block of size 1,152 free'd ==666== at 0x4A2196E: free (vg_replace_malloc.c:323) ==666== by 0x400D31: MAIN__ (in /data03/vondele/bug/io/a.out) ==666== by 0x400D89: main (fmain.c:21) ==666== ==666== Invalid read of size 1 ==666== at 0x4A22E25: strncmp (mc_replace_strmem.c:314) ==666== by 0x4BD83AF: _gfortrani_parse_format (format.c:188) ==666== by 0x4BE4B4F: data_transfer_init (transfer.c:2106) ==666== by 0x400C75: MAIN__ (in /data03/vondele/bug/io/a.out) ==666== by 0x400D89: main (fmain.c:21) ==666== Address 0x55d9219 is 1 bytes inside a block of size 1,152 free'd ==666== at 0x4A2196E: free (vg_replace_malloc.c:323) ==666== by 0x400D31: MAIN__ (in /data03/vondele/bug/io/a.out) ==666== by 0x400D89: main (fmain.c:21) a 0.0000000000 0.0000000000 0.0000000000 a 0.0000000000 0.0000000000 0.0000000000 a 0.0000000000 0.0000000000 0.0000000000 a 0.0000000000 0.0000000000 0.0000000000 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40330