This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31867] function result with character LEN computed at run time
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 May 2007 11:34:23 -0000
- Subject: [Bug fortran/31867] function result with character LEN computed at run time
- References: <bug-31867-14444@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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