https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127384

            Bug ID: 127384
           Summary: SIZEOF wrong result with an unlimited polymorphic
                    variable holding a character value
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mikael at gcc dot gnu.org
  Target Milestone: ---

>From the patch 9 review at [1]:

> gfc_vptr_size_get gives the vptr _size with no _len scaling, so for
> CLASS(*) holding a character the element length is the kind size, not
> the character length:
>
>    character(len=7) :: c
>    class(*), allocatable :: y;  allocate (y, source=c)
>    ! passed on to a CLASS(*) :: a(..) dummy
>    sizeof(a)  =>  1,  expected 7

[1] https://gcc.gnu.org/pipermail/fortran/2026-September/064641.html

Reply via email to