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

            Bug ID: 124962
           Summary: Runtime hangs on accessing automatic character length,
                    pointer object
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pault at gcc dot gnu.org
  Target Milestone: ---

Created attachment 64264
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64264&action=edit
Failing test

While fixing the remaining part of PR64120, I came across this 'wrinkle'. The
runtime hangs on all attempts to directly access 's'. Oddly, the assignment to
the dummy is OK.

The code looks OK to me:

__attribute__((fn spec (". w w ")))
logical(kind=4) h_save (integer(kind=4) & restrict x, integer(kind=4) &
restrict chr_len)
{
  integer(kind=8) .s;
  character(kind=1)[1:.s] * s;
  logical(kind=4) __result_h_save;
  bitsizetype D.4694;
  sizetype D.4695;

  .s = MAX_EXPR <(integer(kind=8)) *x, 0>;
  D.4694 = (bitsizetype) (sizetype) NON_LVALUE_EXPR <.s> * 8;
  D.4695 = (sizetype) NON_LVALUE_EXPR <.s>;
    character(kind=1)[1:.s] * s;
  if (s == 0B)
    {
      {
        integer(kind=8) D.4691;

        D.4691 = (integer(kind=8)) *x;
        s = (character(kind=1)[1:.s] *) &tgt;
      }
      __result_h_save = 0;
    }
  else
    {
      __result_h_save = 1;
    }
  L.1:;
  *chr_len = (integer(kind=4)) .s;
  {
    struct __st_parameter_dt dt_parm.0;

    dt_parm.0.common.filename = &"junk.f90"[1]{lb: 1 sz: 1};
    dt_parm.0.common.line = 23;
    dt_parm.0.common.flags = 128;
    dt_parm.0.common.unit = 6;
    _gfortran_st_write (&dt_parm.0);
    _gfortran_transfer_character_write (&dt_parm.0, s, .s);
    _gfortran_st_write_done (&dt_parm.0);
  }
  return __result_h_save;
}

Paul

Reply via email to