public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/103691] [12 Regression] ICE in get_array_ctor_element_at_index, at fold-const.c:13314 since r12-4694-gcb153222404e2e14
Date: Tue, 04 Jan 2022 11:32:54 +0000	[thread overview]
Message-ID: <bug-103691-4-srQlT3tPzq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103691-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
To me it looks like the PR52329 change wasn't correct.  In particular, it
should have been using true as the second argument and not false and therefore
should have been removed in the r12-21-g0bf8cd9d5e8ac changes rather than kept.
If I modify the testcase from a(0) to a(2), then I see
pr103691.f90.037t.fre1:  # DEBUG D.4293 => &a[0]
and
pr103691.f90.038t.evrp:  # DEBUG D.4293 => &2.0e+0
The &2.0e+0 is just a wrong-debug, debug info was supposed to contain address
of
a, not address of some constant that happens to be in the first element of the
array.
fold_stmt_1 earlier has:
    case GIMPLE_DEBUG:
      if (gimple_debug_bind_p (stmt))
        {
          tree *val = gimple_debug_bind_get_value_ptr (stmt);
          if (*val
              && (REFERENCE_CLASS_P (*val)
                  || TREE_CODE (*val) == ADDR_EXPR)
              && maybe_canonicalize_mem_ref_addr (val, true))
            changed = true;
        }
which I believe should perform whatever PR52329 was meant to deal with.
So I think
          else if (val
                   && TREE_CODE (val) == ADDR_EXPR)
            {
              tree ref = TREE_OPERAND (val, 0);
              tree tem = maybe_fold_reference (ref);
              if (tem)
                {
                  tem = build_fold_addr_expr_with_type (tem, TREE_TYPE (val));
                  gimple_debug_bind_set_value (stmt, tem);
                  changed = true;
                }
            }
should be just dropped.

  parent reply	other threads:[~2022-01-04 11:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 19:51 [Bug fortran/103691] New: [12 Regression] ICE in get_array_ctor_element_at_index, at fold-const.c:13314 gscfq@t-online.de
2021-12-14 10:05 ` [Bug fortran/103691] [12 Regression] ICE in get_array_ctor_element_at_index, at fold-const.c:13314 since r12-4694-gcb153222404e2e14 marxin at gcc dot gnu.org
2021-12-14 15:43 ` amacleod at redhat dot com
2022-01-04 11:07 ` rguenth at gcc dot gnu.org
2022-01-04 11:32 ` jakub at gcc dot gnu.org [this message]
2022-01-04 12:26 ` rguenth at gcc dot gnu.org
2022-01-04 12:28 ` jakub at gcc dot gnu.org
2022-01-05  9:46 ` cvs-commit at gcc dot gnu.org
2022-01-05  9:49 ` jakub at gcc dot gnu.org
2022-03-24 15:23 ` jakub at gcc dot gnu.org
2022-03-25 10:23 ` cvs-commit at gcc dot gnu.org
2022-03-25 10:23 ` jakub 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-103691-4-srQlT3tPzq@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).