[Bug fortran/27760] New: possible bug for array of strings passed to function
vivekrao4 at yahoo dot com
gcc-bugzilla@gcc.gnu.org
Wed May 24 16:58:00 GMT 2006
For the following program, compiled on Windows with the 20060504 Mingw gfortran
with the -fbounds-check option,
program xfoo
integer, parameter :: n = 3
integer :: i,istat(n)
character (len=6) :: words(n)
character (len=1000) :: text
text = "abcdef ghijkl mnopqr"
read (text,*) words
print*,(words(i)," ",i=1,n)
istat = foo(words)
print*,istat
print*,(words(i)," ",i=1,n)
!
contains
function foo(str) result(istat)
character (len=*), intent(in) :: str(:)
integer :: istat(size(str))
istat = 0
end function foo
end program xfoo
the output is
abcdef ghijkl mnopqr
0 0 4268384
abcdef ghijkl mn
The array "words" changes, but it should not. This
problem occurs only when the -fbounds-check option is
used.
Vivek Rao
--
Summary: possible bug for array of strings passed to function
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vivekrao4 at yahoo dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27760
More information about the Gcc-bugs
mailing list