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/104128] ICE in gfc_widechar_to_char, at fortran/scanner.c:199
Date: Sun, 23 Jan 2022 20:07:26 +0000	[thread overview]
Message-ID: <bug-104128-4-kqEPCREk4b@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104128-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from anlauf at gcc dot gnu.org ---
The remaining issues in this PR seem to be related to inconsistencies
between expr->representation.string and expr->value.character.string
that occur for non-default character kind that are created in gfc_copy_expr.

Hackish fix to avoid converting the (bytewise) representation.string for
non-default character kind:

diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index 279d9b30991..ed82a94022f 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -312,7 +312,8 @@ gfc_copy_expr (gfc_expr *p)
          break;

        case BT_CHARACTER:
-         if (p->representation.string)
+         if (p->representation.string
+             && p->ts.kind == gfc_default_character_kind)
            q->value.character.string
              = gfc_char_to_widechar (q->representation.string);
          else

Needs regtesting.

  parent reply	other threads:[~2022-01-23 20:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19 18:51 [Bug fortran/104128] New: " gscfq@t-online.de
2022-01-19 19:29 ` [Bug fortran/104128] " anlauf at gcc dot gnu.org
2022-01-19 21:24 ` anlauf at gcc dot gnu.org
2022-01-21 20:48 ` anlauf at gcc dot gnu.org
2022-01-21 20:49 ` anlauf at gcc dot gnu.org
2022-01-21 22:06 ` anlauf at gcc dot gnu.org
2022-01-23 20:07 ` anlauf at gcc dot gnu.org [this message]
2022-01-23 21:09 ` anlauf at gcc dot gnu.org
2022-01-27 19:39 ` cvs-commit at gcc dot gnu.org
2022-01-27 19:40 ` 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-104128-4-kqEPCREk4b@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).