https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78092
Bug ID: 78092 Summary: ICE when calling SIZEOF on CLASS(*) entry Product: gcc Version: 6.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: holysword at inbox dot com Target Milestone: --- The following test program returns an ICE at line 14 for all versions of gfortran I have tested (up to 6.1) PROGRAM test_stuff IMPLICIT NONE INTEGER :: ivar1(2,3), ivar2 ivar1 = 6 CALL poly_sizeof(ivar1, ivar2) PRINT*, 'ivar2: ', ivar2 CONTAINS SUBROUTINE poly_sizeof(arg1,arg2) CLASS(*), INTENT(IN) :: arg1(:,:) INTEGER, INTENT(OUT) :: arg2 arg2 = SIZEOF(arg1(1,1)) END SUBROUTINE END PROGRAM test_stuff Changing the type of arg1 in line 12 to INTEGER compiles the program and gives the expected result. Changing line 14 to "SIZEOF(arg1)" also works. The problem seems to be specific for when you require the size of a single element of an array of unlimited polymorphic variables.