[Bug fortran/57305] [OOP] ICE when calling SIZEOF on an unlimited polymorphic variable

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Aug 21 15:47:00 GMT 2013


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

--- Comment #8 from janus at gcc dot gnu.org ---
(In reply to janus from comment #7)
> Here is a preliminary patch to make SIZEOF return the size of the dynamic
> type for polymorphic variables, which at the same time fixes the ICE on
> CLASS(*) variables.

Of course this fails on storage_size_1, which expects the old behavior for
CLASS variables, but otherwise it regtests cleany.

Index: gcc/testsuite/gfortran.dg/storage_size_1.f08
===================================================================
--- gcc/testsuite/gfortran.dg/storage_size_1.f08    (revision 201896)
+++ gcc/testsuite/gfortran.dg/storage_size_1.f08    (working copy)
@@ -25,7 +25,7 @@ if (storage_size(a)  /= 64) call abort()
 if (sizeof(b)        /= 24) call abort()
 if (storage_size(b)  /= 64) call abort()

-if (sizeof(cp)       /=  8) call abort()
+if (sizeof(cp)       /= 12) call abort()
 if (storage_size(cp) /= 96) call abort()

 end



More information about the Gcc-bugs mailing list