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

* [Bug fortran/17077] adjustable size arrays crash
  2004-08-18  9:55 [Bug fortran/17077] New: adjustable size arrays crash scottb at uci dot edu
@ 2004-08-19  0:27 ` jvdelisle at verizon dot net
  2004-08-20 13:31 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jvdelisle at verizon dot net @ 2004-08-19  0:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jvdelisle at verizon dot net  2004-08-19 00:27 -------
I have confirmed this segfaults on P4 system running linux, FC 2

Reading specs from
/home/jerry/gftest/usr/local/bin/../lib/gcc/i686-pc-linux-gnu/3.5.0/specs
Configured with: ../gcc-3.5-20040801/configure
Thread model: posix
gcc version 3.5.0 20040801 (experimental)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17077


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

* [Bug fortran/17077] adjustable size arrays crash
  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
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-20 13:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-20 13:31 -------
Subject: Bug 17077

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pbrook@gcc.gnu.org	2004-08-20 13:31:14

Modified files:
	gcc/fortran    : ChangeLog trans-array.c trans-types.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: auto_array_1.f90 

Log message:
	2004-08-20  Paul Brook  <paul@codesourcery.com>
	Canqun Yang  <canqun@nudt.edu.cn>
	
	PR fortran/17077
	* trans-array.c (gfc_conv_array_parameter): Pass correct pointer
	for automatic arrays.
	* trans-types.c (gfc_get_nodesc_array_type): Add comment.
	testsuite/
	* gfortran.dg/auto_array_1.f90: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.158&r2=1.159
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-array.c.diff?cvsroot=gcc&r1=1.17&r2=1.18
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-types.c.diff?cvsroot=gcc&r1=1.10&r2=1.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4164&r2=1.4165
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/auto_array_1.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17077


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

* [Bug fortran/17077] adjustable size arrays crash
  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
  3 siblings, 0 replies; 5+ messages in thread
From: pbrook at gcc dot gnu dot org @ 2004-08-20 13:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pbrook at gcc dot gnu dot org  2004-08-20 13:34 -------
Fixed. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17077


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

* [Bug fortran/17077] adjustable size arrays crash
  2004-08-18  9:55 [Bug fortran/17077] New: adjustable size arrays crash scottb at uci dot edu
                   ` (2 preceding siblings ...)
  2004-08-20 13:34 ` pbrook at gcc dot gnu dot org
@ 2004-08-20 15:37 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-20 15:37 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |3.5.0


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