[Bug fortran/17077] New: adjustable size arrays crash
scottb at uci dot edu
gcc-bugzilla@gcc.gnu.org
Wed Aug 18 09:55:00 GMT 2004
Using adjustable size arrays in subroutines causes some memory alloc problem.
It crashes my system, other times results in gibberish output.
I have put a program below that fails. It works on other f90 compilers.
WORKAROUND: When I replace adjustable size arrays (e.g. x(n,n)) with assumed
size arrays (e.g., x(:,:)) it all works fine. No idea why.
I use Mac OS X 10.3 (Darwin6.8) on dual G5.
GCC version 3.5-tree-ssa-lno 20040811 (merged 20040718).
Configured with /gcc/configure --enable-threads=posix --enable-languages=c,f95
!Program that fails.
program p
implicit none
integer:: n
n=3
call foo(n)
contains
subroutine foo(m)
integer:: m,i
real, dimension(m,m):: z
! Print z. It's OK here (all zero).
do i=1,m
write(*,*) z(i,:)
enddo
call foo1(z)
end subroutine foo
subroutine foo1(x)
integer:: n,i,j
real, dimension(:,:):: x
! Print z. It's not OK here (memory garbage).
do i=1,n
write(*,*) x(i,1:n)
enddo
end subroutine foo1
end program p
--
Summary: adjustable size arrays crash
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: scottb at uci dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17077
More information about the Gcc-bugs
mailing list