public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/58586] [OOP] ICE with derived type with a polymorphic allocatable component passed by value
Date: Tue, 01 Oct 2013 21:13:00 -0000	[thread overview]
Message-ID: <bug-58586-4-Jhww9FiFiL@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58586-4@http.gcc.gnu.org/bugzilla/>

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.


  reply	other threads:[~2013-10-01 21:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-30 21:57 [Bug fortran/58586] New: " vladimir.fuka at gmail dot com
2013-10-01 21:13 ` burnus at gcc dot gnu.org [this message]
2014-01-05 12:34 ` [Bug fortran/58586] [OOP] " dominiq at lps dot ens.fr
2014-01-05 13:53 ` [Bug fortran/58586] ICE with derived type with " janus at gcc dot gnu.org
2014-01-05 14:00 ` janus at gcc dot gnu.org
2015-04-15 18:04 ` vehre at gcc dot gnu.org
2015-05-11  9:08 ` dominiq at lps dot ens.fr
2015-05-11 10:06 ` juergen.reuter at desy dot de
2015-07-06 10:26 ` vehre at gcc dot gnu.org
2015-07-09 10:42 ` vehre at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-58586-4-Jhww9FiFiL@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).