[Bug fortran/47523] Concatenation with deferred length character with lhs variable
tkoenig at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jan 28 21:15:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47523
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Wrong length in I/O |Concatenation with deferred
|deferred allocatable scalar |length character with lhs
|character |variable
--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-01-28 20:58:49 UTC ---
Actually, it isn't a wrong length, the problem was an
invisible nul character in the output.
Look at this:
program main
implicit none
integer :: i
character(:), allocatable :: a, b, c
a = 'a'
a = a // 'x'
b = 'b'
c = b // 'x'
write (*,*) 'a is:'
do i=1,len(a)
write (*,*) ichar(a(i:i))
end do
write (*,*) 'c is:'
do i=1,len(c)
write (*,*) ichar(c(i:i))
end do
end program main
ig25@linux-fd1f:~/Krempel/Char-alloc> gfortran bar.f90
ig25@linux-fd1f:~/Krempel/Char-alloc> ./a.out
a is:
97
0
c is:
98
120
The expression a = a // 'x' gets the wrong value for x.
More information about the Gcc-bugs
mailing list