public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/17077] New: adjustable size arrays crash
@ 2004-08-18  9:55 scottb at uci dot edu
  2004-08-19  0:27 ` [Bug fortran/17077] " jvdelisle at verizon dot net
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: scottb at uci dot edu @ 2004-08-18  9:55 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-08-20 15:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-18  9:55 [Bug fortran/17077] New: adjustable size arrays crash scottb at uci dot edu
2004-08-19  0:27 ` [Bug fortran/17077] " jvdelisle at verizon dot net
2004-08-20 13:31 ` cvs-commit at gcc dot gnu dot org
2004-08-20 13:34 ` pbrook at gcc dot gnu dot org
2004-08-20 15:37 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).