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/49324] Deep copy missing for array constructors of DT w/ allocatable components
Date: Thu, 09 Jun 2011 22:23:00 -0000	[thread overview]
Message-ID: <bug-49324-4-AFLVqqas0t@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-49324-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-06-09 22:22:39 UTC ---
The following should partially helps: It solves the segfault for
  z(:) = [ x, y ]
and does a deep copy.

TODO:
- I miss a freeing of the components of the LHS, there is currently just a
malloc, cf. 
- Realloc on assign does not work properly:
  * Valgrind shows: "Conditional jump or move depends on uninitialised value"
  * Values print Ok, but afterwards it segfaults
- with reshape, the values are still wrong.

--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -5347,6 +5347,9 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse,
gfc_typespec ts,
                          tmp);
          gfc_add_expr_to_block (&block, tmp);
        }
+      else
+       gfc_add_expr_to_block (&block,gfc_copy_alloc_comp (ts.u.derived,
+                                                          rse->expr,
lse->expr, 0));
     }
   else if (ts.type == BT_DERIVED || ts.type == BT_CLASS)
     {


  parent reply	other threads:[~2011-06-09 22:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-08 15:07 [Bug fortran/49324] New: iso_varying_string and reshape fail jjcogliati-r1 at yahoo dot com
2011-06-08 16:23 ` [Bug fortran/49324] " burnus at gcc dot gnu.org
2011-06-08 16:30 ` jjcogliati-r1 at yahoo dot com
2011-06-08 22:13 ` burnus at gcc dot gnu.org
2011-06-09  7:27 ` [Bug fortran/49324] Deep copy missing for array constructors of DT w/ allocatable components burnus at gcc dot gnu.org
2011-06-09 22:23 ` burnus at gcc dot gnu.org [this message]
2011-06-10  8:35 ` burnus at gcc dot gnu.org
2011-06-10 12:45 ` burnus at gcc dot gnu.org
2011-06-11 22:09 ` burnus at gcc dot gnu.org
2011-06-14 13:08 ` burnus at gcc dot gnu.org
2011-06-17  6:12 ` burnus at gcc dot gnu.org
2011-07-11 16:38 ` jjcogliati-r1 at yahoo dot com
2011-07-11 16:53 ` burnus at gcc dot gnu.org
2023-06-21  9:27 ` damian at archaeologic dot codes

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-49324-4-AFLVqqas0t@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).