public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/64397] [OOP] Runtime segfault with type-bound assignment and parenthesis
Date: Tue, 23 Dec 2014 22:10:00 -0000	[thread overview]
Message-ID: <bug-64397-4-JuCcZWfdYt@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

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
The difference in the dumps for

program main
  use num
  type(my_integer) :: a, c
  a=my_integer([1])
  c = a                       ! -
end

and

program main
  use num
  type(my_integer) :: a, c
  a=my_integer([1])
  c = (a)                     ! +
end

is

--- pr64397_red.f90.003t.original    2014-12-23 22:44:37.000000000 +0100
+++ pr64397_red_1.f90.003t.original    2014-12-23 22:45:12.000000000 +0100
@@ -276,7 +276,7 @@ ass (struct __class_num_My_integer_t & r
             {
               if (a->_data->x.data != 0B)
                 {
-                  _gfortran_runtime_error_at (&"At line 17 of file
pr64397_red.f90"[1]{lb: 1 sz: 1}, &"Attempting to allocate already allocated
variable \'%s\'"[1]{lb: 1 sz: 1}, &"a"[1]{lb: 1 sz: 1});
+                  _gfortran_runtime_error_at (&"At line 17 of file
pr64397_red_1.f90"[1]{lb: 1 sz: 1}, &"Attempting to allocate already allocated
variable \'%s\'"[1]{lb: 1 sz: 1}, &"a"[1]{lb: 1 sz: 1});
                 }
               else
                 {
@@ -445,14 +445,40 @@ MAIN__ ()
     class.11._data->x.data = 0B;
   }
   {
+    void * restrict D.3563;
+    integer(kind=8) D.3562;
+    integer(kind=8) D.3561;
+    integer(kind=8) D.3560;
+    struct __class_num_My_integer_t D.3559;
+    struct my_integer D.3558;
     struct __class_num_My_integer_t class.16;
     struct __class_num_My_integer_t class.15;

     class.15._vptr = (struct __vtype_num_My_integer * {ref-all})
&__vtab_num_My_integer;
     class.15._data = (struct my_integer *) &c;
     class.16._vptr = (struct __vtype_num_My_integer * {ref-all})
&__vtab_num_My_integer;
-    class.16._data = (struct my_integer *) &a;
+    D.3558 = a;
+    class.16._data = (struct my_integer *) &D.3558;
+    D.3559 = class.16;
     ass (&class.15, &class.16);
+    if ((void *) D.3559.x.data != 0B)
+      {
+        D.3560 = (D.3559.x.dim[0].ubound - D.3559.x.dim[0].lbound) + 1;
+        D.3561 = NON_LVALUE_EXPR <D.3560>;
+      }
+    if (class.16._data->x.data != 0B)
+      {
+        __builtin_free ((void *) class.16._data->x.data);
+      }
+    class.16._data->x.data = 0B;
   }
 }


  parent reply	other threads:[~2014-12-23 22:10 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 ` janus at gcc dot gnu.org
2014-12-23 22:10 ` dominiq at lps dot ens.fr [this message]
2014-12-23 22:19 ` janus at gcc dot gnu.org
2014-12-23 22:27 ` [Bug fortran/64397] [OOP] Runtime segfault with parenthesis expression passed to polymorphic dummy argument janus at gcc dot gnu.org
2014-12-23 22:44 ` 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-JuCcZWfdYt@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).