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)
     {

Reply via email to