public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/64209] [OOP] runtime segfault with CLASS(*), INTENT(OUT) dummy argument
Date: Thu, 18 Dec 2014 23:24:00 -0000	[thread overview]
Message-ID: <bug-64209-4-8jOocvqrqk@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64209-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from janus at gcc dot gnu.org ---
Here is a reduced test case for the remaining segfault:

PROGRAM main
  IMPLICIT NONE
  INTEGER :: copy_x(3)
  CALL copy(1,copy_x)
  PRINT *, copy_x
CONTAINS
  SUBROUTINE copy(x,a)
    integer, INTENT(IN) :: x
    CLASS(*), INTENT(OUT) :: a(:)
      SELECT TYPE(a); TYPE IS(integer)
    a(:) = x
      END SELECT
  END SUBROUTINE
END PROGRAM


It's a very similar scheme as in comment #2, only this time we have an
array-valued CLASS(*), INTENT(OUT) argument.


I think the problem is with _def_init being NULL again. For the array case here
the dump shown a line like:

    a->_vptr->_copy (a->_vptr->_def_init, &a->_data);

Again we need a conditional check for _def_init being non-NULL.


  parent reply	other threads:[~2014-12-18 23:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-06 16:00 [Bug fortran/64209] New: [OOP] copy class(*) component from type with a subroutine polajnar.miha at gmail dot com
2014-12-09 19:27 ` [Bug fortran/64209] " dominiq at lps dot ens.fr
2014-12-18 19:20 ` [Bug fortran/64209] [OOP] runtime segfault with CLASS(*), INTENT(OUT) dummy argument janus at gcc dot gnu.org
2014-12-18 20:58 ` janus at gcc dot gnu.org
2014-12-18 22:07 ` janus at gcc dot gnu.org
2014-12-18 22:53 ` janus at gcc dot gnu.org
2014-12-18 23:24 ` janus at gcc dot gnu.org [this message]
2014-12-19 19:29 ` janus at gcc dot gnu.org
2014-12-19 19:32 ` janus 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-64209-4-8jOocvqrqk@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).