public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31867]  New: function result with character LEN computed at run time
@ 2007-05-08 15:28 beliavsky at aol dot com
  2007-05-09  0:10 ` [Bug fortran/31867] " jvdelisle at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: beliavsky at aol dot com @ 2007-05-08 15:28 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2007-05-31 18:53 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-08 15:28 [Bug fortran/31867] New: function result with character LEN computed at run time beliavsky at aol dot com
2007-05-09  0:10 ` [Bug fortran/31867] " jvdelisle at gcc dot gnu dot org
2007-05-09  0:33 ` jvdelisle at gcc dot gnu dot org
2007-05-09  6:33 ` burnus at gcc dot gnu dot org
2007-05-09 14:27 ` beliavsky at aol dot com
2007-05-10 11:34 ` burnus at gcc dot gnu dot org
2007-05-11 11:09 ` pault at gcc dot gnu dot org
2007-05-11 12:13 ` pault at gcc dot gnu dot org
2007-05-14 19:51 ` pault at gcc dot gnu dot org
2007-05-15  9:56 ` pault at gcc dot gnu dot org
2007-05-15 12:40 ` patchapp at dberlin dot org
2007-05-21 13:16 ` pault at gcc dot gnu dot org
2007-05-21 13:19 ` [Bug fortran/31867] [4.2 only] " pault at gcc dot gnu dot org
2007-05-31 18:51 ` pault at gcc dot gnu dot org
2007-05-31 18:53 ` pault at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).