This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/51864] New: [OOP] ALLOCATE with polymorphic array constructor as SOURCE=
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 15 Jan 2012 12:55:12 +0000
- Subject: [Bug fortran/51864] New: [OOP] ALLOCATE with polymorphic array constructor as SOURCE=
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51864
Bug #: 51864
Summary: [OOP] ALLOCATE with polymorphic array constructor as
SOURCE=
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
See also http://gcc.gnu.org/ml/fortran/2012-01/msg00147.html
The following program causes gfortran to ICE with a segfault. The program
compiles with NAG f95 5.1 and crayftn 7.1 - though it segfaults at run time.
I think the program is valid F2003/F2008.
type t
integer :: i = 5
end type t
type, extends(t) :: t2
integer :: j = 6
end type t2
class(t), allocatable :: a(:), b(:), c(:)
allocate(t2 :: a(3))
allocate(t2 :: b(5))
!allocate(c, source=[ a, b ]) ! F2008, PR 44672
allocate(c(8), source=[ a, b ])
! c = [ a, b ] ! F2008, PR 43366
select type(c)
type is(t)
print '(8(i2))', c%i
type is(t2)
print '(8(i2))', c%i
print '(8(i2))', c%j
end select
end