! { dg-do run }
!
! PR 57305: [OOP] ICE when calling SIZEOF on an unlimited polymorphic variable
!
! Contributed by Vladimir Fuka <vladimir.fuka@gmail.com>

  type :: t
  end type
  
  type, extends(t) :: t2
    integer(4) :: i
  end type
  
  type(t), target :: a
  type(t2), target :: b
  integer(8), target :: i
  real(4), target :: r

  class(*), pointer :: c

  c => a
  if (sizeof(c)       /=  0) call abort
  if (storage_size(c) /=  0) call abort

  c => b
  if (sizeof(c)       /=  4) call abort
  if (storage_size(c) /= 32) call abort

  c => i
  if (sizeof(c)       /=  8) call abort
  if (storage_size(c) /= 64) call abort

  c => r
  if (sizeof(c)       /=  4) call abort
  if (storage_size(c) /= 32) call abort
end
