aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>2006-10-31 21:15:22 +0100
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2006-10-31 20:15:22 +0000
commit150675a88bae488e66055ad2a1eba0309ecabce3 (patch)
tree1024583b95a9dd9e2598bb3e446caa4624ef6e9f /gcc/fortran/expr.c
parent70198b9f22c93aeab38aacafe9e2aec87d126813 (diff)
downloadgcc-150675a88bae488e66055ad2a1eba0309ecabce3.zip
gcc-150675a88bae488e66055ad2a1eba0309ecabce3.tar.gz
gcc-150675a88bae488e66055ad2a1eba0309ecabce3.tar.bz2
re PR fortran/29067 (gfc_resolve_expr(): Bad expression type)
PR fortran/29067 * decl.c (gfc_set_constant_character_len): NULL-terminate the character constant string. * data.c (create_character_intializer): Likewise. * expr.c (gfc_simplify_expr): NULL-terminate the substring character constant. * primary.c (match_hollerith_constant): NULL-terminate the character constant string. * gfortran.dg/pr29067.f: New test. From-SVN: r118338
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r--gcc/fortran/expr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 1f51fd0..d2da0d8 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -1438,7 +1438,7 @@ gfc_simplify_expr (gfc_expr * p, int type)
gfc_extract_int (p->ref->u.ss.end, &end);
s = gfc_getmem (end - start + 1);
memcpy (s, p->value.character.string + start, end - start);
- s[end] = '\0'; /* TODO: C-style string for debugging. */
+ s[end-start+1] = '\0'; /* TODO: C-style string for debugging. */
gfc_free (p->value.character.string);
p->value.character.string = s;
p->value.character.length = end - start;