[Bug fortran/31867] function result with character LEN computed at run time
burnus at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu May 10 11:34:00 GMT 2007
------- 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
More information about the Gcc-bugs
mailing list