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,commited] Fix for PR 29713


Hi all,

I commited the following fix for PR 29713, a stupid bug arising from my NULL-termination patch, on mainline. I'll be waiting for objections and to see if something happens before backporting it to 4.2 and 4.1.


Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c (revision 118455)
+++ gcc/fortran/expr.c (working copy)
@@ -1436,7 +1436,7 @@
gfc_extract_int (p->ref->u.ss.start, &start);
start--; /* Convert from one-based to zero-based. */
gfc_extract_int (p->ref->u.ss.end, &end);
- s = gfc_getmem (end - start + 1);
+ s = gfc_getmem (end - start + 2);
memcpy (s, p->value.character.string + start, end - start);
s[end-start+1] = '\0'; /* TODO: C-style string for debugging. */
gfc_free (p->value.character.string);



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