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/64397] [OOP] Runtime segfault with parenthesis expression passed to polymorphic dummy argument
Date: Tue, 23 Dec 2014 22:27:00 -0000	[thread overview]
Message-ID: <bug-64397-4-4rdkv0X5FQ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64397-4@http.gcc.gnu.org/bugzilla/>

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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[OOP] Runtime segfault with |[OOP] Runtime segfault with
                   |type-bound assignment and   |parenthesis expression
                   |parenthesis                 |passed to polymorphic dummy
                   |                            |argument

--- Comment #4 from janus at gcc dot gnu.org ---
As shown by -fdump-tree-original, the first call to 'ass' is translated to:

  {
    struct __class_main_My_integer_t class.11;

    class.11._vptr = (struct __vtype_main_My_integer * {ref-all})
&__vtab_main_My_integer;
    class.11._data = (struct my_integer *) &a;
    ass (&class.11);
  }


The second call, however, is translated to:

  {
    void * restrict D.3514;
    integer(kind=8) D.3513;
    integer(kind=8) D.3512;
    integer(kind=8) D.3511;
    struct __class_main_My_integer_t D.3510;
    struct my_integer D.3509;
    struct __class_main_My_integer_t class.13;

    class.13._vptr = (struct __vtype_main_My_integer * {ref-all})
&__vtab_main_My_integer;
    D.3509 = a;
    class.13._data = (struct my_integer *) &D.3509;
    D.3510 = class.13;
    ass (&class.13);
    if ((void *) D.3510.x.data != 0B)
      {
        D.3511 = (D.3510.x.dim[0].ubound - D.3510.x.dim[0].lbound) + 1;
        D.3512 = NON_LVALUE_EXPR <D.3511>;
        D.3513 = D.3512 * 4;
        D.3514 = (void * restrict) __builtin_malloc (MAX_EXPR <(unsigned long)
D.3513, 1>);
        class.13.x.data = D.3514;
        __builtin_memcpy ((real(kind=4)[0:] * restrict) class.13.x.data,
(real(kind=4)[0:] * restrict) D.3510.x.data, (unsigned long) (D.3512 * 4));
      }
    else
      {
        class.13.x.data = 0B;
      }
    if (class.13._data->x.data != 0B)
      {
        __builtin_free ((void *) class.13._data->x.data);
      }
    class.13._data->x.data = 0B;
  }


While nothing is done after the call itself in the first case, quite a bit of
cleanup-code is added in the second case (which is also seen in comment 2.


  parent reply	other threads:[~2014-12-23 22:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-64397-4@http.gcc.gnu.org/bugzilla/>
2014-12-23 21:52 ` [Bug fortran/64397] [OOP] Runtime segfault with type-bound assignment and parenthesis janus at gcc dot gnu.org
2014-12-23 22:10 ` dominiq at lps dot ens.fr
2014-12-23 22:19 ` janus at gcc dot gnu.org
2014-12-23 22:27 ` janus at gcc dot gnu.org [this message]
2014-12-23 22:44 ` [Bug fortran/64397] [OOP] Runtime segfault with parenthesis expression passed to polymorphic dummy argument patnel97269-gfortran at yahoo dot fr
2014-12-23 22:59 ` janus at gcc dot gnu.org
2014-12-23 23:19 ` patnel97269-gfortran at yahoo dot fr

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-64397-4-4rdkv0X5FQ@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).