http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46328

           Summary: ICE with class in parentheses
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: tkoe...@gcc.gnu.org


Reported by Damian Rouson in

http://gcc.gnu.org/ml/fortran/2010-11/msg00100.html

module field_module
  implicit none
  type ,abstract :: field
  contains
    procedure(field_op_real) ,deferred :: multiply_real
    generic :: operator(*) => multiply_real
  end type
  abstract interface
    function field_op_real(lhs,rhs)
      import :: field
      class(field) ,intent(in)  :: lhs
      real ,intent(in) :: rhs
      class(field) ,allocatable :: field_op_real
    end function
  end interface
end module

program main
  use field_module
  implicit none
  class(field) ,pointer :: u
  u = (u)*2.
end program

gets a segementation fault:

program received signal SIGSEGV, Segmentation fault.
0x00000000004b1b5c in gfc_add_component_ref (e=0x14589a0, name=0xd4bf9d
"$vptr")
    at ../../trunk/gcc/fortran/class.c:61
61        gfc_symbol *derived = e->symtree->n.sym->ts.u.derived;

because the symtree is not set:

(gdb) p e->symtree
$3 = (gfc_symtree *) 0x0
(gdb) p *e
$2 = {expr_type = EXPR_FUNCTION, ts = {type = BT_CLASS, kind = 0, u = {derived
= 0x1454c50,
      cl = 0x1454c50, pad = 21318736}, interface = 0x0, is_c_interop = 0,
is_iso_c = 0,
    f90_type = BT_CLASS}, rank = 0, shape = 0x0, symtree = 0x0, ref = 0x0,
where = {
    nextc = 0x14449a8, lb = 0x1444970}, is_boz = 0, is_snan = 0, error = 0,
user_operator = 0,
  mold = 0, representation = {length = 0, string = 0x0}, value = {logical =
21310080,
    iokind = 21310080, integer = {{_mp_alloc = 21310080, _mp_size = 0, _mp_d =
0x7ffff7fc40b0}},
    real = {{_mpfr_prec = 21310080, _mpfr_sign = -134463312, _mpfr_exp = 0,
_mpfr_d = 0x1455160}},
    complex = {{re = {{_mpfr_prec = 21310080, _mpfr_sign = -134463312,
_mpfr_exp = 0,
            _mpfr_d = 0x1455160}}, im = {{_mpfr_prec = 1, _mpfr_sign = 0,
_mpfr_exp = 0,
            _mpfr_d = 0x0}}}}, op = {op = 21310080, uop = 0x7ffff7fc40b0, op1 =
0x0,
      op2 = 0x1455160}, function = {actual = 0x1452a80, name = 0x7ffff7fc40b0
"field_op_real",
      isym = 0x0, esym = 0x1455160}, compcall = {actual = 0x1452a80,
      name = 0x7ffff7fc40b0 "field_op_real", base_object = 0x0, tbp =
0x1455160, ignore_pass = 1,
      assign = 0}, character = {length = 21310080, string = 0x7ffff7fc40b0},

Reply via email to