This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR32156 - [4.3 Regression] ICE with characters
- From: Tobias Burnus <burnus at net-b dot de>
- To: Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>
- Cc: "fortran at gcc dot gnu dot org List" <fortran at gcc dot gnu dot org>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 01 Jun 2007 09:37:32 +0200
- Subject: Re: [Patch, fortran] PR32156 - [4.3 Regression] ICE with characters
- References: <339c37f20705311417k74ec4a3fg893c80fb6cc05468@mail.gmail.com>
Paul,
Paul Richard Thomas wrote:
> You will excuse me if I fixed this one as 'obvious'.
> In fact, I am not entirely happy with this fix and left a TODO to
> reflect this. There is something not right with string concatenation
> in the front-end that fails to transmit the string length correctly.
> I have made several attempts to get to the bottom of this and have
> completely failed. I will not forget about it:)
Would it make sense to open a PR for the TODO just to make sure it does
not get forgotten?
Tobias
The commit logs are available at:
http://gcc.gnu.org/ml/gcc-cvs/2007-05/msg00956.html
http://gcc.gnu.org/viewcvs?view=rev&revision=125240
The patch is:
--- trunk/gcc/fortran/trans-array.c 2007/05/31 21:11:31 125240
+++ trunk/gcc/fortran/trans-array.c 2007/05/31 21:12:10 125241
@@ -1635,8 +1635,18 @@
if (!ss->string_length)
gfc_todo_error ("complex character array constructors");
- ss->expr->ts.cl->backend_decl = ss->string_length;
+ /* It is surprising but still possible to wind up with expressions that
+ lack a character length.
+ TODO Find the offending part of the front end and cure this properly.
+ Concatenation involving arrays is the main culprit. */
+ if (!ss->expr->ts.cl)
+ {
+ ss->expr->ts.cl = gfc_get_charlen ();
+ ss->expr->ts.cl->next = gfc_current_ns->cl_list;
+ gfc_current_ns->cl_list = ss->expr->ts.cl->next;
+ }
+ ss->expr->ts.cl->backend_decl = ss->string_length;
type = gfc_get_character_type_len (ss->expr->ts.kind, ss->string_length);
if (const_string)