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/93685] [9/10/11 Regression] ICE in gfc_constructor_append_expr, at fortran/constructor.c:135
Date: Sun, 20 Dec 2020 21:58:56 +0000	[thread overview]
Message-ID: <bug-93685-4-O6bgt7dIcO@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-93685-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from anlauf at gcc dot gnu.org ---
The following seems to do the latter job:

diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index bfe08be2a94..f66afab85d1 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -7877,12 +7877,14 @@ gfc_conv_initializer (gfc_expr * expr, gfc_typespec *
ts, tree type,
          return se.expr;

        case BT_CHARACTER:
-         {
-           tree ctor = gfc_conv_string_init (ts->u.cl->backend_decl,expr);
-           TREE_STATIC (ctor) = 1;
-           return ctor;
-         }
+         if (expr->expr_type == EXPR_CONSTANT)
+           {
+             tree ctor = gfc_conv_string_init (ts->u.cl->backend_decl, expr);
+             TREE_STATIC (ctor) = 1;
+             return ctor;
+           }

+         /* Fallthrough.  */
        default:
          gfc_init_se (&se, NULL);
          gfc_conv_constant (&se, expr);

  parent reply	other threads:[~2020-12-20 21:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-93685-4@http.gcc.gnu.org/bugzilla/>
2020-03-12 11:58 ` [Bug fortran/93685] [9/10 " jakub at gcc dot gnu.org
2020-12-19 22:08 ` [Bug fortran/93685] [9/10/11 " anlauf at gcc dot gnu.org
2020-12-20 21:26 ` anlauf at gcc dot gnu.org
2020-12-20 21:58 ` anlauf at gcc dot gnu.org [this message]
2020-12-20 22:16 ` anlauf at gcc dot gnu.org
2020-12-27 19:36 ` cvs-commit at gcc dot gnu.org
2020-12-29 20:28 ` cvs-commit at gcc dot gnu.org
2020-12-29 20:32 ` 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-93685-4-O6bgt7dIcO@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).