public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47024] New: [OOP] STORAGE_SIZE (for polymorphic types): Segfault at run time
@ 2010-12-20  9:35 burnus at gcc dot gnu.org
  2010-12-20  9:47 ` [Bug fortran/47024] " burnus at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-12-20  9:35 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: janus@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


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

end of thread, other threads:[~2011-01-05  9:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-20  9:35 [Bug fortran/47024] New: [OOP] STORAGE_SIZE (for polymorphic types): Segfault at run time burnus at gcc dot gnu.org
2010-12-20  9:47 ` [Bug fortran/47024] " burnus at gcc dot gnu.org
2010-12-20 15:17 ` janus at gcc dot gnu.org
2010-12-20 16:48 ` burnus at gcc dot gnu.org
2011-01-04 13:39 ` janus at gcc dot gnu.org
2011-01-04 13:49 ` janus at gcc dot gnu.org
2011-01-04 18:58 ` janus at gcc dot gnu.org
2011-01-05  9:05 ` janus at gcc dot gnu.org
2011-01-05  9:17 ` janus at gcc dot gnu.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).