public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sgk at troutmask dot apl.washington.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/98458] ICE in gfc_conv_array_initializer due to array expressions within implied do-loop
Date: Wed, 30 Dec 2020 18:12:57 +0000	[thread overview]
Message-ID: <bug-98458-4-g1G51chkHB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98458-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98458

--- Comment #8 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Wed, Dec 30, 2020 at 01:40:22PM +0000, pault at gcc dot gnu.org wrote:
> --- Comment #7 from Paul Thomas <pault at gcc dot gnu.org> ---
> (In reply to Steve Kargl from comment #6)
> 
> Hi Steve,
> 
> I didn't check for any new postings when I attached my version
> of the patch.  Apologies for treading on your toes.... again :-)

You didn't step on any toes.  I think your original patch is
better than mine, because it applies to any place where
is_constant_array_expr() is called.  I suspect your patch is
probably better placed someplace in gfc_simplify_expr(), but
that is for another day.

> > My proposed patch fixes the issue in one spot.  Paul's
> > patch fixes potentially many spots.  Unfortunately, the
> > handling of implied do-loops is done in an ad hoc fashion,
> > and is complicated by the potential problem of exhausting
> > the stack.
> 
> I like your use of gfc_reduce_init_expr since it also does
> a type check.  Note though that it resets gfc_reduce_init_expr
> and so it needs to be set once again after the call.

Ah, good point about resetting gfc_reduce_init_expr flag.

When debugging the problem, I found that

source=[ [1,2], [2,3], [3,4] ]

so the implied do-loop was expanded, but the array was not
simplified to [1, 2, 2, 3, 3, 4].  This was causing 
gfc_simplify_reshape to return NULL. 

> I had totally forgotten about the 'fatal' flag needing to be
> set in the call to gfc_expand_constructor to avoid stack
> exhaustion. I had to rediscover it experimentally.

implied do-loops in PARAMETER statements have been a problem
for a long time.  I only remember the problem with exhausting
the stack, because I chose flag_max_array_constructor = 65535.

> A combined patch is being regtested now.

Thanks.

  parent reply	other threads:[~2020-12-30 18:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-28  4:20 [Bug fortran/98458] New: implied do-loop used in initialization with RESHAPE throw ICE xiao.liu@compiler-dev.com
2020-12-28 12:03 ` [Bug fortran/98458] PRINT the array constructed from implied do-loop " anlauf at gcc dot gnu.org
2020-12-28 13:26 ` dominiq at lps dot ens.fr
2020-12-28 20:09 ` kargl at gcc dot gnu.org
2020-12-29 17:28 ` pault at gcc dot gnu.org
2020-12-30  0:52 ` xiao.liu@compiler-dev.com
2020-12-30  2:19 ` sgk at troutmask dot apl.washington.edu
2020-12-30 13:40 ` [Bug fortran/98458] ICE in gfc_conv_array_initializer due to array expressions within implied do-loop pault at gcc dot gnu.org
2020-12-30 18:12 ` sgk at troutmask dot apl.washington.edu [this message]
2021-01-05 11:39 ` pault at gcc dot gnu.org
2021-01-08 10:11 ` cvs-commit at gcc dot gnu.org
2021-05-04 12:31 ` rguenth at gcc dot gnu.org
2023-10-31 17:19 ` pault at gcc dot gnu.org

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=bug-98458-4-g1G51chkHB@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).