From: Mikael Morin <mikael.morin@sfr.fr>
To: Andre Vehreschild <vehre@gmx.de>
Cc: GCC-Patches-ML <gcc-patches@gcc.gnu.org>,
GCC-Fortran-ML <fortran@gcc.gnu.org>
Subject: Re: [Patch, Fortran, PR58586, v2] ICE with derived type with allocatable component passed by value
Date: Sun, 26 Apr 2015 10:23:00 -0000 [thread overview]
Message-ID: <553CBC80.2050208@sfr.fr> (raw)
In-Reply-To: <20150423200052.2e7a1311@gmx.de>
Hello,
I'm reviewing the original patch only for now.
The added bits in v2 will have to wait.
Le 23/04/2015 20:00, Andre Vehreschild a écrit :
>>> diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
>>> index 9e6432f..80dfed1 100644
>>> --- a/gcc/fortran/trans-expr.c
>>> +++ b/gcc/fortran/trans-expr.c
>>> @@ -5344,8 +5344,19 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol *
>>> sym, && (e->expr_type != EXPR_VARIABLE && !e->rank))
>>> {
>>> int parm_rank;
>>> - tmp = build_fold_indirect_ref_loc (input_location,
>>> - parmse.expr);
>>> + /* It is known the e returns a structure type with at least one
>>> + allocatable component. When e is a function, ensure that the
>>> + function is called once only by using a temporary variable.
>>> */
>>> + if (e->expr_type == EXPR_FUNCTION)
>>> + parmse.expr = gfc_evaluate_now_loc (input_location,
>>> + parmse.expr, &se->pre);
>> You need not limit this to functions only.
>> I think you can even do this without condition.
>
> Yes, one could do that, but then an unnecessary temporary variable in the - for
> my taste - already too clobbered pseudo code is introduced. Furthermore, is the
> penalty on doing the check for a function negligible. I therefore have not
> changed that.
All right; would you mind writing it either
if (e->expr_type != EXPR_VARIABLE)
or
if (!DECL_P (parmse.expr))
or
if (!VAR_P (parmse.expr))
instead?
>
>>> + if (POINTER_TYPE_P (TREE_TYPE (parmse.expr)))
>> This distinguishes arguments with/without value attribute, right?
>> I think it's better to use the frontend information here (fsym->attr.value).
>
> Changed to check for value.
Please check fsym && fsym->attr.value
and add the following testcase (it fails with the patch).
module m
type :: t
integer, allocatable :: comp
end type
type :: u
type(t), allocatable :: comp
end type
end module m
use m
call sub(u())
end
OK with these changes.
>
>> Ah, and don't forget to provide a ChangeLog entry with it.
>
> The Changelog entry comes in an additional attachment.
>
It doesn't appear inline in my mailer as its content type is
application/octet-stream, so I missed it. Sorry.
Thanks for the patch. I will review the rest later.
Mikael
next prev parent reply other threads:[~2015-04-26 10:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-15 18:03 [Patch, Fortran, PR58586, v1] " Andre Vehreschild
2015-04-19 10:01 ` Mikael Morin
2015-04-23 18:01 ` [Patch, Fortran, PR58586, v2] " Andre Vehreschild
2015-04-24 8:37 ` Andre Vehreschild
2015-04-26 10:23 ` Mikael Morin [this message]
2015-05-05 9:00 ` [Patch, Fortran, PR58586, v3] " Andre Vehreschild
2015-05-07 10:15 ` Mikael Morin
2015-05-08 10:54 ` Andre Vehreschild
2015-05-08 13:21 ` Mikael Morin
2015-05-08 13:31 ` Andre Vehreschild
2015-05-08 14:11 ` Andre Vehreschild
2015-05-19 14:02 ` [Patch, Fortran, PR58586, v4] " Andre Vehreschild
2015-07-03 9:29 ` [Ping, Patch, Fortran, PR58586, v5] " Andre Vehreschild
2015-07-04 16:25 ` Steve Kargl
2015-07-04 19:20 ` Andre Vehreschild
2015-07-05 16:15 ` Steve Kargl
2015-07-05 17:48 ` Paul Richard Thomas
2015-07-05 18:14 ` Steve Kargl
2015-07-06 10:32 ` [commited, " Andre Vehreschild
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=553CBC80.2050208@sfr.fr \
--to=mikael.morin@sfr.fr \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=vehre@gmx.de \
/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).