This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR65792 - allocation of scalar elemental function with structure constructor fails
- From: Mikael Morin <mikael dot morin at sfr dot fr>
- To: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>, Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- Cc: Andre Vehreschild <vehre at gmx dot de>, "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 09 May 2015 15:12:42 +0200
- Subject: Re: [Patch, fortran] PR65792 - allocation of scalar elemental function with structure constructor fails
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sfrmc.priv.atos.fr; dkim=none (no signature); dkim-adsp=none (no policy) header dot from=mikael dot morin at sfr dot fr
- References: <CAGkQGiKfuxfsnHuwGnsk5R7f=bOu3OzvxtZweL0cGzMmHDGAkQ at mail dot gmail dot com> <20150426185319 dot GA29878 at troutmask dot apl dot washington dot edu> <CAGkQGiK0puVoALMW36TzdoWPE=zw8fNOEu2uzeAEO6CJe2SUoA at mail dot gmail dot com> <CAGkQGiK442R2=p=m-gHHkK=cZKvyUT5QvAiGMbEjCP2gieeOLA at mail dot gmail dot com>
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);