https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98408
Bug ID: 98408 Summary: Character lengths for allocatable character arrays Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: tkoenig at gcc dot gnu.org Target Milestone: --- Consider program main character (len=:), allocatable :: a(:) allocate (character(len=10) :: a(5)) end program main This yields (in the tree dump) D.3941 = (bitsizetype) (sizetype) NON_LVALUE_EXPR <.a> * 8; D.3942 = (sizetype) NON_LVALUE_EXPR <.a>; a.data = 0B; { integer(kind=4) overflow.0; logical(kind=4) not_prev_allocated.1; .a = 10; And later, if you use size_in_bytes (gfc_get_element_type (TREE_TYPE(se->expr))) you get an undefined variable. Strange...