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/113956] [13/14 Regression] ice in gfc_trans_pointer_assignment, at fortran/trans-expr.cc:10524
Date: Fri, 29 Mar 2024 12:03:25 +0000	[thread overview]
Message-ID: <bug-113956-4-LNlE5sM2Co@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113956-4@http.gcc.gnu.org/bugzilla/>

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.3
                 CC|                            |anlauf at gcc dot gnu.org,
                   |                            |pault at gcc dot gnu.org
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|                            |2024-03-29
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
            Summary|[14 Regression] ice in      |[13/14 Regression] ice in
                   |gfc_trans_pointer_assignmen |gfc_trans_pointer_assignmen
                   |t, at                       |t, at
                   |fortran/trans-expr.cc:10524 |fortran/trans-expr.cc:10524

--- Comment #2 from anlauf at gcc dot gnu.org ---
Reduced testcase:

subroutine test_array_char(p, x)
  character(*), target  :: x(100)
  character(:), pointer :: p(:)
  p => x
end subroutine


We hit an assert that can be worked around with the following patch:

diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index d21e3956d6e..fa31f950363 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -10534,12 +10535,9 @@ gfc_trans_pointer_assignment (gfc_expr * expr1,
gfc_expr * expr2)
        {
          gfc_symbol *psym = expr1->symtree->n.sym;
          tmp = NULL_TREE;
-         if (psym->ts.type == BT_CHARACTER)
-           {
-             gcc_assert (psym->ts.u.cl->backend_decl
-                         && VAR_P (psym->ts.u.cl->backend_decl));
-             tmp = psym->ts.u.cl->backend_decl;
-           }
+         if (psym->ts.type == BT_CHARACTER
+             && psym->ts.u.cl->backend_decl)
+           tmp = psym->ts.u.cl->backend_decl;
          else if (expr1->ts.u.cl->backend_decl
                   && VAR_P (expr1->ts.u.cl->backend_decl))
            tmp = expr1->ts.u.cl->backend_decl;


This fragment was touched by Paul's fix for pr67740 (r14-4583), so adding
him.

@Paul: can you please have a look?

  parent reply	other threads:[~2024-03-29 12:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16  8:20 [Bug fortran/113956] New: " dcb314 at hotmail dot com
2024-03-29  9:53 ` [Bug fortran/113956] [14 Regression] " dcb314 at hotmail dot com
2024-03-29 12:03 ` anlauf at gcc dot gnu.org [this message]
2024-03-29 15:35 ` [Bug fortran/113956] [13/14 " pault at gcc dot gnu.org
2024-03-29 16:37 ` anlauf at gcc dot gnu.org
2024-04-02 19:19 ` anlauf at gcc dot gnu.org
2024-04-03 13:06 ` pault at gcc dot gnu.org
2024-04-09 14:23 ` cvs-commit at gcc dot gnu.org
2024-04-17 13:34 ` law at gcc dot gnu.org
2024-05-08  8:06 ` [Bug fortran/113956] [13 " cvs-commit at gcc dot gnu.org
2024-05-08  8:08 ` 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-113956-4-LNlE5sM2Co@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).