]> gcc.gnu.org Git - gcc.git/commitdiff
re PR fortran/29713 (ICE in gfc_set_constant_character_len decl.c:762)
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>
Sat, 4 Nov 2006 20:58:26 +0000 (21:58 +0100)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Sat, 4 Nov 2006 20:58:26 +0000 (20:58 +0000)
PR fortran/29713

* expr.c (gfc_simplify_expr): Correct memory allocation.

* gfortran.dg/pr29713.f90: New test.

From-SVN: r118483

gcc/fortran/ChangeLog
gcc/fortran/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr29713.f90 [new file with mode: 0644]

index 800ba511f2a2b4614c4ca5d74581ec558496a807..64d3bafa8d489d9c2f8aab30ab08148da56e8480 100644 (file)
@@ -1,3 +1,8 @@
+2006-11-04  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+       PR fortran/29713
+       * expr.c (gfc_simplify_expr): Correct memory allocation.
+
 2006-11-02  Brooks Moses  <brooks.moses@codesourcery.com>
 
        * error.c (show_locus): Remove "In file" from error messages.
index d2da0d845c3504b530d12fb87084990783594ad8..486da131d89368a3288ddb94d4713b5eec0fc1b1 100644 (file)
@@ -1436,7 +1436,7 @@ gfc_simplify_expr (gfc_expr * p, int type)
          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 1949db13719ddce40a1aef83c3f00a077beb2eee..6ca95da9743a7e814852239a3c2a0e181dc1bb4f 100644 (file)
@@ -1,3 +1,8 @@
+2006-11-04  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+       PR libfortran/29713
+       * gfortran.dg/pr29713.f90: New test.
+
 2006-11-03  J"orn Rennecke  <joern.rennecke@st.com>
 
        * testsuite/gcc.c-torture/execute/arith-rand-ll.c:
@@ -6,8 +11,7 @@
 2006-11-03  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
 
        PR libfortran/27895
-       * gcc/testsuite/gfortran.dg/zero_sized_1.f90: Uncomment checks
-       for RESHAPE.
+       * gfortran.dg/zero_sized_1.f90: Uncomment checks for RESHAPE.
 
 2006-11-02  Brooks Moses  <brooks.moses@codesourcery.com>
 
diff --git a/gcc/testsuite/gfortran.dg/pr29713.f90 b/gcc/testsuite/gfortran.dg/pr29713.f90
new file mode 100644 (file)
index 0000000..be4accd
--- /dev/null
@@ -0,0 +1,6 @@
+! { dg-do compile }
+      character*2 a
+      character*4 b
+      parameter (a="12")
+      parameter (b = a(1:2))
+      end
This page took 0.123687 seconds and 5 git commands to generate.