public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34681]  New: SAVEd derived type with allocatable components causes ICE
@ 2008-01-05 21:32 pault at gcc dot gnu dot org
  2008-01-06 10:39 ` [Bug fortran/34681] " burnus at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-01-05 21:32 UTC (permalink / raw)
  To: gcc-bugs

The following segfaults on the second call to mah because the allocatable
components are automatically deallocated.  I have yet to check the F2003
standard but this logically makes no sense.  It comes about because t.data is
NULLED on entry to mah

program boh
  !
  call mah (0)
  call mah (1)
  call mah (2)
  !
end program boh
!
subroutine mah (i)
  !
  integer, intent(in) :: i
  !
  type mix_type
     real(8), allocatable :: a(:)
     complex(8), allocatable :: b(:)
  end type mix_type
  type(mix_type), allocatable, save :: t(:)
  integer :: j, n=1024
  !
  if (i==0) then
     allocate (t(1))
     allocate (t(1)%a(n))
     allocate (t(1)%b(n))
     do j=1,n
        t(1)%a(j) = j
        t(1)%b(j) = n-j
     end do
  end if
  c = sum( t(1)%a(:) ) + sum( t(1)%b(:) )
  print *, 'c=',c
  if ( i==2) then
     deallocate (t(1)%b)
     deallocate (t(1)%a)
     deallocate (t)
  end if
end subroutine mah

Posted to the list by F-X COudert

http://gcc.gnu.org/ml/fortran/2008-01/msg00044.html


-- 
           Summary: SAVEd derived type with allocatable components causes
                    ICE
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pault at gcc dot gnu dot org


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


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

* [Bug fortran/34681] SAVEd derived type with allocatable components causes ICE
  2008-01-05 21:32 [Bug fortran/34681] New: SAVEd derived type with allocatable components causes ICE pault at gcc dot gnu dot org
@ 2008-01-06 10:39 ` burnus at gcc dot gnu dot org
  2008-01-08  9:53 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-06 10:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2008-01-06 10:08 -------
Patch posted by Paul:
http://gcc.gnu.org/ml/fortran/2008-01/msg00048.html


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-01-06 10:08:09
               date|                            |


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


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

* [Bug fortran/34681] SAVEd derived type with allocatable components causes ICE
  2008-01-05 21:32 [Bug fortran/34681] New: SAVEd derived type with allocatable components causes ICE pault at gcc dot gnu dot org
  2008-01-06 10:39 ` [Bug fortran/34681] " burnus at gcc dot gnu dot org
@ 2008-01-08  9:53 ` burnus at gcc dot gnu dot org
  2008-01-08 15:16 ` pault at gcc dot gnu dot org
  2008-01-08 16:00 ` pault at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-08  9:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2008-01-08 09:22 -------
Patch by Paul: http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00269.html


-- 


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


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

* [Bug fortran/34681] SAVEd derived type with allocatable components causes ICE
  2008-01-05 21:32 [Bug fortran/34681] New: SAVEd derived type with allocatable components causes ICE pault at gcc dot gnu dot org
  2008-01-06 10:39 ` [Bug fortran/34681] " burnus at gcc dot gnu dot org
  2008-01-08  9:53 ` burnus at gcc dot gnu dot org
@ 2008-01-08 15:16 ` pault at gcc dot gnu dot org
  2008-01-08 16:00 ` pault at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-01-08 15:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2008-01-08 15:13 -------
Subject: Bug 34681

Author: pault
Date: Tue Jan  8 15:12:34 2008
New Revision: 131395

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131395
Log:
2008-01-08  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/34681
        * trans_array.c (gfc_trans_deferred_array): Do not null the
        data pointer on entering scope, nor deallocate it on leaving
        scope, if the symbol has the 'save' attribute.

        PR fortran/34704
        * trans_decl.c (gfc_finish_var_decl): Derived types with
        allocatable components and an initializer must be TREE_STATIC.

2008-01-08  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/34681
        PR fortran/34704
        * gfortran.dg/alloc_comp_default_init_1.f90: New test.



Added:
    trunk/gcc/testsuite/gfortran.dg/alloc_comp_default_init_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/34681] SAVEd derived type with allocatable components causes ICE
  2008-01-05 21:32 [Bug fortran/34681] New: SAVEd derived type with allocatable components causes ICE pault at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-01-08 15:16 ` pault at gcc dot gnu dot org
@ 2008-01-08 16:00 ` pault at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-01-08 16:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2008-01-08 15:16 -------
Fixed on trunk

Paul


-- 

pault at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-01-08 15:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-05 21:32 [Bug fortran/34681] New: SAVEd derived type with allocatable components causes ICE pault at gcc dot gnu dot org
2008-01-06 10:39 ` [Bug fortran/34681] " burnus at gcc dot gnu dot org
2008-01-08  9:53 ` burnus at gcc dot gnu dot org
2008-01-08 15:16 ` pault at gcc dot gnu dot org
2008-01-08 16:00 ` pault 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).