From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19350 invoked by alias); 8 May 2007 15:28:28 -0000 Received: (qmail 18477 invoked by uid 48); 8 May 2007 15:28:15 -0000 Date: Tue, 08 May 2007 15:28:00 -0000 Subject: [Bug fortran/31867] New: function result with character LEN computed at run time X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "beliavsky at aol dot com" 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/msg00614.txt.bz2 The program module util_mod implicit none contains function join(words,sep) result(str) ! trim and concatenate a vector of character variables, ! inserting sep between them character (len=*), intent(in) :: words(:),sep character (len=(size(words)-1)*len(sep) + sum(len_trim(words))) :: str integer :: i,nw nw = size(words) str = "" if (nw < 1) then return else str = words(1) end if do i=2,nw str = trim(str) // sep // words(i) end do end function join end module util_mod ! program xjoin use util_mod, only: join implicit none character (len=5) :: words(2) = (/"two ","three"/) write (*,"(1x,'words = ',a)") "'"//join(words," ")//"'" end program xjoin gives words = 'two threeg9' but I think it should give words = 'two three' gfortran -v says Using built-in specs. Target: i386-pc-mingw32 Configured with: ../trunk/configure --prefix=/mingw --enable-languages=c,fortran,c++,objc,obj-c++ --with-gmp=/home/coudert/local --disable-nls --with-ld=/mingw/bin/ld --with-as=/mingw/bin/as --disable-werror --enable-bootstrap --enable-threads --build=i386-pc-mingw32 --disable-shared --enable-libgomp Thread model: win32 gcc version 4.3.0 20070406 (experimental) -- Summary: function result with character LEN computed at run time Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: beliavsky at aol dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31867