From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6223 invoked by alias); 10 Jun 2009 21:18:10 -0000 Received: (qmail 6179 invoked by uid 48); 10 Jun 2009 21:17:56 -0000 Date: Wed, 10 Jun 2009 21:18:00 -0000 Message-ID: <20090610211756.6178.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libfortran/40330] [4.4, 4.5 Regression] incorrect IO In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jb at gcc dot gnu dot org" 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/msg00674.txt.bz2 ------- Comment #24 from jb at gcc dot gnu dot org 2009-06-10 21:17 ------- Further reduced testcase: program pr40330 implicit none call s1() call s1() contains subroutine s1() character(LEN=100) :: a a = "(3X)" write(*,FMT='('//trim(a)//",a,' ')", ADVANCE="NO") "3" end subroutine s1 end program pr40330 The interesting thing is, if you replace the trim(a) with trim("(3X)") then it works. Look at -fdump-tree-original to see the difference; in the second case the format string is a constant, in the first it's not and it's deallocated, which might be related to why we get the valgrind errors about reading from free'd storage. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40330