This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[gfortran] Fix PR14067



In PR14067 we ICE when compiling this code:
PROGRAM GNEXDATA
CHARACTER*31 GNCRMESS
C 1 2 3 4
C 1234567890123456789012345678901234567890
DATA GNCRMESS/' *** COASTAL RADAR NOT LOADED *** '/
PRINT*,GNCRMESS
RETURN
END
The reason is that we choke on the overlong initialization. The appended patch fixes this bug, or actually it uses the fact that the backend deals with this correctly.


This patch has been in my tree for a while and didn't cause trouble. It also was bootstrapped and regtested several times with no regressions.

- Tobi

2004-05-30 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>

	* trans-const.c (gfc_conv_string_init): Allow variable string
	length lower than initialization string length.


Index: trans-const.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/fortran/trans-const.c,v retrieving revision 1.4 diff -u -p -r1.4 trans-const.c --- trans-const.c 18 May 2004 16:48:09 -0000 1.4 +++ trans-const.c 30 May 2004 14:41:37 -0000 @@ -106,8 +106,8 @@ gfc_conv_string_init (tree length, gfc_e

   len = TREE_INT_CST_LOW (length);
   slen = expr->value.character.length;
-  assert (len >= slen);
-  if (len != slen)
+
+  if (len > slen)
     {
       s = gfc_getmem (len);
       memcpy (s, expr->value.character.string, slen);


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