This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/58586] [OOP] ICE with derived type with a polymorphic allocatable component passed by value


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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |4.7.3, 4.8.1, 4.9.0

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(The code compiles successfully with crayftn, pgf95 and ifort.)


(In reply to Vladimir Fuka from comment #0)
> 0x5b19b0 structure_alloc_comps
>         ../../gcc-4.8-20130425/gcc/fortran/trans-array.c:7440

That's for der_type->name == "b" and debug_tree(decl) gives:
 <indirect_ref 0x2aaaac2e9bc0 side-effects
    arg 0 <call_expr 0x2aaaac1f6750
        type <record_type 0x2aaaac2f75e8 b TI

Hence, decl_type == NULL - which will crash at:
7464    structure_alloc_comps (gfc_symbol * der_type, tree decl,
7465                           tree dest, int rank, int purpose)
...
7487      decl_type = TREE_TYPE (decl);
(gdb) 
7489      if ((POINTER_TYPE_P (decl_type) && rank != 0)
              || (TREE_CODE (decl_type) == REFERENCE_TYPE && rank == 0))


That's called from:
      /* Allocated allocatable components of derived types must be
         deallocated for non-variable scalars.  Non-variable arrays are
         dealt with in trans-array.c(gfc_conv_array_parameter).  */
      if (e && (e->ts.type == BT_DERIVED || e->ts.type == BT_CLASS)
            && e->ts.u.derived->attr.alloc_comp
            && !(e->symtree && e->symtree->n.sym->attr.pointer)
            && (e->expr_type != EXPR_VARIABLE && !e->rank))
        {
...
          tmp = gfc_deallocate_alloc_comp (e->ts.u.derived, tmp, parm_rank);

          gfc_add_expr_to_block (&se->post, tmp);
        }

which shows that a temporary is required.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]