This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR32156 - [4.3 Regression] ICE with characters


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]