This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR65792 - allocation of scalar elemental function with structure constructor fails


Le 01/05/2015 20:25, Paul Richard Thomas a écrit :
> Dear All,
> 
> By the time I went to commit, something had changed and the patch
> caused a regression. I presume that the version that I had of Andre's
> patch was not the same as the one committed. I'll cast an eye over it
> this weekend and see if I can understand what gives.
> 
Hello Paul,

to get things moving again, I propose the attached fix to your patch.
Tested on alloc_comp_deep_copy_1 only for now.

Mikael



diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 6cf5fe2..532f4b7 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -7078,7 +7078,8 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr,
 	    }
 	  gfc_add_modify (&block, dest,
 			  fold_convert (TREE_TYPE (dest), se.expr));
-	  if (cm->ts.u.derived->attr.alloc_comp)
+	  if (cm->ts.u.derived->attr.alloc_comp
+	      && expr->expr_type != EXPR_NULL)
 	    {
 	      tmp = gfc_copy_alloc_comp (cm->ts.u.derived, se.expr,
 					 dest, expr->rank);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]