This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/42610] [OOP] CLASS with ALLOCATABLE + SAVE: Not initialized / ICE
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jan 2010 13:57:53 -0000
- Subject: [Bug fortran/42610] [OOP] CLASS with ALLOCATABLE + SAVE: Not initialized / ICE
- References: <bug-42610-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from burnus at gcc dot gnu dot org 2010-01-06 13:57 -------
The following also looks bogus:
static struct t a = {.i=4};
Though, it seems to work - contrary to the version in comment 0.
program test
implicit none
type t
integer :: i = 4
integer, allocatable :: a(:)
end type t
call sub (0)
call sub (1)
call sub (2)
contains
subroutine sub (no)
integer, intent(in) :: no
type(t), save :: a
if (no == 0) then
if (allocated (a%a)) call abort ()
allocate (a%a(1))
else if (no == 1) then
if (.not. allocated (a%a)) call abort ()
deallocate (a%a)
else
if (allocated (a%a)) call abort ()
end if
end subroutine sub
end program test
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42610