[Bug fortran/47189] New: [OOP] calling STORAGE_SIZE on a NULL-initialized class pointer

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 6 13:18:00 GMT 2011


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

           Summary: [OOP] calling STORAGE_SIZE on a NULL-initialized class
                    pointer
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: janus@gcc.gnu.org


Follow-up to PR47180 / PR47024:

type :: t
  real(4) :: c
end type
class(t), pointer :: x => null()
print *, storage_size (x)
end

This currently gives a segfault at runtime, because the _vptr component of 'x'
is wrongly initialized to NULL, while it should point to the vtab of the
declared type. If one adds an additional pointer assignment statement

x => null()

everything works fine (due to the fix of PR47180). Only the NULL initialization
still gets it wrong.



More information about the Gcc-bugs mailing list