public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/93339] [9/10 Regression] ICE in gimplify_var_or_parm_decl, at gimplify.c:2830
Date: Wed, 08 Apr 2020 14:45:57 +0000	[thread overview]
Message-ID: <bug-93339-4-uGAJnZCoNf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-93339-4@http.gcc.gnu.org/bugzilla/>

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 48243
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48243&action=edit
Extended test case

I have tried with GCC 7 – while some variants to not crash, others do and it
also does not work at run time. The full test case shows the same compile-time
error as trunk (see last item in this comment). Hence, it is not a "real"
regression.

 * * * 

The problem is at
     associate (y => x%a)
here,
  expr = "x%a"
but
  expr->ts.u.cl->backend_decl == ".z".

When processing "associate (y => x%a)", gfc_get_array_span() gets the
descriptor (desc) and the "expr" from above as input. (When called from
trans_associate_var.)

Thus, one ends up with:
    integer(kind=8) .y;
    struct array01_unknown y;

    y = x.a;
    y.span = .z;  // should be .y instead (+ at some point initialized)

If one uses "y => x%a(:)(1:3)", one gets:
  .z = 3
Hence, .z is no longer uninitialized. Still, '.z' is not defined in this scope
→ which causes the ICE.

If one only has only one ASSOCIATE, this works has there is only a '.y'.

In the attached test case (when commenting the two inner associate):
  'y = x%a(:)(1:3)' works
  but 'y2 => x%a' fails at the run-time check as 'y == ['AB','CD'] instead of
['ABC','DEF'] (why?)

 * * *

Additionally, there are odd errors for the inner associate, which does not show
up for the outer associate; it might be well related to the expr->ts.u.cl
issue, but could also be an issue of its own.  

     associate (z => x%a(:)(1:2))
                           1
Error: Substring end index at (1) exceeds the string length
foo3.f90:18:31:

     associate (z => x%a(:)(1:2))
                               1
Error: Entity ‘z’ at (1) has a deferred type parameter and requires either the
POINTER or ALLOCATABLE attribute

  parent reply	other threads:[~2020-04-08 14:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-93339-4@http.gcc.gnu.org/bugzilla/>
2020-03-12 11:58 ` jakub at gcc dot gnu.org
2020-04-08 14:45 ` burnus at gcc dot gnu.org [this message]
2021-06-01  8:15 ` [Bug fortran/93339] [9/10/11/12 " rguenth at gcc dot gnu.org
2022-05-27  9:41 ` [Bug fortran/93339] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:39 ` jakub at gcc dot gnu.org
2023-04-08  8:04 ` cvs-commit at gcc dot gnu.org
2023-04-08  9:32 ` 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-93339-4-uGAJnZCoNf@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).