From: Mikael Morin <morin-mikael@orange.fr>
To: Harald Anlauf <anlauf@gmx.de>, fortran <fortran@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, fortran] Improve expansion of constant array expressions within constructors
Date: Tue, 30 Nov 2021 21:51:46 +0100 [thread overview]
Message-ID: <ab40dc8d-a6e0-fd41-f395-4edd6b16ade5@orange.fr> (raw)
In-Reply-To: <trinity-6c2ea06f-d063-4853-8e5c-3713b118c3f7-1638046587840@3c-app-gmx-bs26>
Hello,
On 27/11/2021 21:56, Harald Anlauf via Fortran wrote:
> diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
> index 6552eaf3b0c..fbc66097c80 100644
> --- a/gcc/fortran/array.c
> +++ b/gcc/fortran/array.c
> @@ -1804,6 +1804,12 @@ expand_constructor (gfc_constructor_base base)
> if (empty_constructor)
> empty_ts = e->ts;
>
> + /* Simplify constant array expression/section within constructor. */
> + if (e->expr_type == EXPR_VARIABLE && e->rank > 0 && e->ref
> + && e->symtree && e->symtree->n.sym
> + && e->symtree->n.sym->attr.flavor == FL_PARAMETER)
> + gfc_simplify_expr (e, 0);
> +
> if (e->expr_type == EXPR_ARRAY)
> {
> if (!expand_constructor (e->value.constructor))
There is another simplification call just a few lines below, that I
thought could just be moved up.
But it works on a copy of the expression, and managing the copy makes it
complex as well, so let’s do it your way.
OK.
prev parent reply other threads:[~2021-11-30 20:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-27 20:56 Harald Anlauf
2021-11-30 20:51 ` Mikael Morin [this message]
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=ab40dc8d-a6e0-fd41-f395-4edd6b16ade5@orange.fr \
--to=morin-mikael@orange.fr \
--cc=anlauf@gmx.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@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).