This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[gfortran] Fix PR14067
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: GCC Fortran mailing list <fortran at gcc dot gnu dot org>,patch <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 30 May 2004 16:50:06 +0200
- Subject: [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);