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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #3 from kargl at gcc dot gnu.org ---
The problematic code is in resolve.c at lines 8028-8040.

This code was added in r241885 by vehre.  I don't see 
how this code can possible work for an allocation of
an array of derived types as all information about the
array shape of mold has been striped.

      if (code->expr3 && code->expr3->mold
          && code->expr3->ts.type == BT_DERIVED)
        {
          /* Default initialization via MOLD (non-polymorphic).  */
          gfc_expr *rhs = gfc_default_initializer (&code->expr3->ts);
          if (rhs != NULL)
            {
              gfc_resolve_expr (rhs);
              gfc_free_expr (code->expr3);
              code->expr3 = rhs;
            }
        }

Prior to the if statement one has

(gdb) p *code->expr3
$3 = {expr_type = EXPR_VARIABLE, ts = {type = BT_DERIVED, kind = 0, u = {
      derived = 0x20306f600, cl = 0x20306f600, pad = 50787840}, interface =
0x0, 
    is_c_interop = 0, is_iso_c = 0, f90_type = BT_UNKNOWN, deferred = false, 
    interop_kind = 0x0}, rank = 1, shape = 0x2031689f0, symtree = 0x2023a45d0, 
  ref = 0x203149300, where = {nextc = 0x20308a9cc, lb = 0x20308a960}, base_expr
= 0x0, 
  is_boz = 0, is_snan = 0, error = 0, user_operator = 0, mold = 1,
must_finalize = 0, 
  no_bounds_check = 0, external_blas = 0, do_not_resolve_again = 0,
representation = {
    length = 0, string = 0x0}, value = {logical = 0, iokind = M_READ, integer =
{{
        _mp_alloc = 0, _mp_size = 0, _mp_d = 0x0}}, real = {{_mpfr_prec = 0, 
        _mpfr_sign = 0, _mpfr_exp = 0, _mpfr_d = 0x0}}, complex = {{re = {{
            _mpfr_prec = 0, _mpfr_sign = 0, _mpfr_exp = 0, _mpfr_d = 0x0}}, im
= {{
            _mpfr_prec = 0, _mpfr_sign = 0, _mpfr_exp = 0, _mpfr_d = 0x0}}}},
op = {
      op = GFC_INTRINSIC_BEGIN, uop = 0x0, op1 = 0x0, op2 = 0x0}, function = {
      actual = 0x0, name = 0x0, isym = 0x0, esym = 0x0}, compcall = {actual =
0x0, 
      name = 0x0, base_object = 0x0, tbp = 0x0, ignore_pass = 0, assign = 0}, 
    character = {length = 0, string = 0x0}, constructor = 0x0}, param_list =
0x0}

after the if () completes, one has

$4 = {expr_type = EXPR_STRUCTURE, ts = {type = BT_DERIVED, kind = 0, u = {
      derived = 0x20306f600, cl = 0x20306f600, pad = 50787840}, interface =
0x0, 
    is_c_interop = 0, is_iso_c = 0, f90_type = BT_UNKNOWN, deferred = false, 
    interop_kind = 0x0}, rank = 0, shape = 0x0, symtree = 0x0, ref = 0x0, where
= {
    nextc = 0x20306a1d0, lb = 0x20306a190}, base_expr = 0x0, is_boz = 0,
is_snan = 0, 
  error = 0, user_operator = 0, mold = 0, must_finalize = 0, no_bounds_check =
0, 
  external_blas = 0, do_not_resolve_again = 0, representation = {length = 0, 
    string = 0x0}, value = {logical = 51159296, iokind = 51159296, integer = {{
        _mp_alloc = 51159296, _mp_size = 2, _mp_d = 0x0}}, real = {{
        _mpfr_prec = 8641093888, _mpfr_sign = 0, _mpfr_exp = 0, _mpfr_d =
0x0}}, 
    complex = {{re = {{_mpfr_prec = 8641093888, _mpfr_sign = 0, _mpfr_exp = 0, 
            _mpfr_d = 0x0}}, im = {{_mpfr_prec = 0, _mpfr_sign = 0, _mpfr_exp =
0, 
            _mpfr_d = 0x0}}}}, op = {op = 51159296, uop = 0x0, op1 = 0x0, op2 =
0x0}, 
    function = {actual = 0x2030ca100, name = 0x0, isym = 0x0, esym = 0x0},
compcall = {
      actual = 0x2030ca100, name = 0x0, base_object = 0x0, tbp = 0x0,
ignore_pass = 0, 
      assign = 0}, character = {length = 8641093888, string = 0x0}, 
    constructor = 0x2030ca100}, param_list = 0x0}

Code compiles if I delete the suspicious code.

Reply via email to