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,committed] Fixed memory allocation in expr.c for 4.2 [PR29713]


Hi,

Tobias Burnus wrote:
> Same fix needs to be done for 4.1 as
> http://gcc.gnu.org/viewcvs/branches/gcc-4_1-branch/gcc/fortran/expr.c?view=markup
> shows.
>   
Now also checked in in to the gcc-4_1-branch after regtesting on
x86_64-unknown-linux-gnu-gcc.

Tobias
(As the original patch for the trunk came from FX I credit him)

Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog       (Revision 118703)
+++ gcc/fortran/ChangeLog       (Arbeitskopie)
@@ -1,3 +1,8 @@
+2006-11-11  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+       PR fortran/29713
+       * expr.c (gfc_simplify_expr): Correct memory allocation.
+
 2006-11-10 Paul Thomas <pault@gcc.gnu.org>

        Backport from mainline.
Index: gcc/fortran/expr.c
===================================================================
--- gcc/fortran/expr.c  (Revision 118703)
+++ gcc/fortran/expr.c  (Arbeitskopie)
@@ -1485,7 +1485,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]