public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/103283] ICE in gfc_trans_array_constructor_subarray, at fortran/trans-array.c:1972
Date: Fri, 03 Dec 2021 21:22:57 +0000	[thread overview]
Message-ID: <bug-103283-4-0eCtG1aStM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103283-4@http.gcc.gnu.org/bugzilla/>

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code

--- Comment #4 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #3)
>   integer, parameter :: k(*) = x(1)%a

> 
> This fails with:
> 
> pr103283-z1.f90:6:28:
> 
>     6 |   integer, parameter :: k(*) = x(1)%a
>       |                            1
> Error: Cannot initialize implied-shape array at (1) with scalar

Doing some debugging, we seem to lose the shape when simplifying the r.h.s.
near the end of expr.c::simplify_parameter_variable:

  /* Do not copy subobject refs for constant.  */
  if (e->expr_type != EXPR_CONSTANT && p->ref != NULL)
    e->ref = gfc_copy_ref (p->ref);
  t = gfc_simplify_expr (e, type);

Initially the ref looks fine, but it might be evaluated improperly.
We end up with a scalar instead of a rank-1 array.

  parent reply	other threads:[~2021-12-03 21:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16 18:33 [Bug fortran/103283] New: " gscfq@t-online.de
2021-11-16 18:34 ` [Bug fortran/103283] " gscfq@t-online.de
2021-11-30 21:34 ` anlauf at gcc dot gnu.org
2021-11-30 21:41 ` anlauf at gcc dot gnu.org
2021-12-03 21:22 ` anlauf at gcc dot gnu.org [this message]
2021-12-04 21:07 ` anlauf 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-103283-4-0eCtG1aStM@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).