http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47024
Summary: [OOP] STORAGE_SIZE (for polymorphic types): Segfault at run time Product: gcc Version: 4.6.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org CC: ja...@gcc.gnu.org STORAGE_SIZE does not work for unallocated polymorphic types. However, the Fortran 2008 standard allows them: "A shall be a scalar or array of any type. If it is polymorphic it shall not be an undefined pointer. If it has any deferred type parameters it shall not be an unallocated allocatable variable or a disassociated or undefined pointer." (F2008, 13.7.160) Note: The standard allows an unallocated polymorphic variable - as long as the type does not have any deferred type parameter. Fortunately, CLASS(*) does not seem to be allowed as "CLASS(*)" has no type. Maybe one should cross check (e.g. at the J3 mailing list) to see whether the proper result is the declared type or something else. implicit none type t integer :: a end type t type, extends(t) :: t2 integer :: b end type t2 class(t), allocatable :: y print *, storage_size(y)/8 ! Expected: "4"; in reality: segfault end