This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/31867] function result with character LEN computed at run time



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]