From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30570 invoked by alias); 10 May 2007 11:34:34 -0000 Received: (qmail 30496 invoked by uid 48); 10 May 2007 11:34:23 -0000 Date: Thu, 10 May 2007 11:34:00 -0000 Message-ID: <20070510113423.30495.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/31867] function result with character LEN computed at run time In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus 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: 2007-05/txt/msg00775.txt.bz2 ------- Comment #5 from burnus at gcc dot gnu dot org 2007-05-10 12:34 ------- Reduced test case, which gives still the same valgrind error. In addition, len(join(words)) should give 8 not 10. Using "len=5" instead of "len=*" or "words(2)" instead of "words(:) fixes both. (=> "8" and no valgrind error) program xjoin implicit none character (len=5) :: words(2) = (/"two ","three"/) write (*,*) len(join(words)) ! should be 8 is 10 write (*,*) join(words) ! valgrind error contains function join(words) result(str) character (len=*), intent(in) :: words(:) character (len=sum(len_trim(words))) :: str str = '' end function join end program xjoin -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |wrong-code Last reconfirmed|0000-00-00 00:00:00 |2007-05-10 12:34:22 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31867