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

--- Comment #3 from kargls at comcast dot net ---
(In reply to kargls from comment #2)
> (In reply to kargls from comment #1)
> > Reduced testcase.
> > 
> > module m11
> >   real, target :: trgt
> >   type :: t(ln)
> >     integer, len :: ln
> >     real, pointer :: pntr => trgt
> >   end type
> >  contains
> >   subroutine s1(x)
> >     type(t(*)), intent(in) :: x
> >   end subroutine
> > end module
> 
> Using gdb to trace the ICE, I get to 
> 
> (gdb) c
> Breakpoint 2, gfc_delete_symtree (root=0x20434a400, name=0x204bfc258 "Pdtt")
>     at ../../gccx/gcc/fortran/symbol.cc:3039
> 3039      p = strrchr(name, '.');
> 
> If I continue, the ICE occurs.  Stepping into gfc_delete_symtree(), I
> end up in symbol.cc:compare_symtree()
> 
> (gdb) p *st1
> $7 = {priority = -8304, left = 0xa6b085 <gfc_match_ptr_fcn_assign()+69>, 
>   right = 0x204298170, name = 0x204bfc258 "Pdtt", ambiguous = 69455616, n = {
>     sym = 0x10, uop = 0x10, common = 0x10, tb = 0x10, omp_udr = 0x10}, 
>   import_only = 0}
> (gdb) p *st2
> $8 = {priority = 14192, left = 0x0, right = 0x2043a0640, 
>   name = 0x204bfc258 "Pdtt", ambiguous = 0, n = {sym = 0x20423cf00, 
>     uop = 0x20423cf00, common = 0x20423cf00, tb = 0x20423cf00, 
>     omp_udr = 0x20423cf00}, import_only = 0}

So, tearing down the namespace get to 

(gdb) 
Continuing.

Breakpoint 3.16, gfc_free_expr (e=0x20420ce00)
    at ../../gccx/gcc/fortran/expr.cc:583
583       if (e == NULL)
(gdb) p *e
$12 = {expr_type = EXPR_UNKNOWN, ts = {type = BT_UNKNOWN, kind = 0, u = {
      derived = 0x0, cl = 0x0, pad = 0}, interface = 0x0, is_c_interop = 0, 
    is_iso_c = 0, f90_type = BT_UNKNOWN, deferred = false, 
    interop_kind = 0x0}, rank = 0, corank = 0, shape = 0x0, symtree = 0x0, 
  ref = 0x0, where = {nextc = 0x0, u = {lb = 0x0, location = 0}}, 
  base_expr = 0x0, 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, do_not_warn = 0, from_constructor = 0, 
  representation = {length = 0, string = 0x0}, boz = {len = 0, rdx = 0, 
    str = 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, conditional = {condition = 0x0, 
      true_expr = 0x0, false_expr = 0x0}}, param_list = 0x0}

The ICE occurs because expr_type == EXPR_UNKNOWN, free_expr0() is unhappy.

Reply via email to