diff options
author | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-31 20:15:22 +0000 |
---|---|---|
committer | fxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-31 20:15:22 +0000 |
commit | 89f528df98c041a719fc7ccbf2f7dd0f8448cdb0 (patch) | |
tree | 1024583b95a9dd9e2598bb3e446caa4624ef6e9f /gcc/fortran/expr.c | |
parent | 6b95ae38a6e40df1498dfdc0c3a8070507389a04 (diff) | |
download | ppe42-gcc-89f528df98c041a719fc7ccbf2f7dd0f8448cdb0.tar.gz ppe42-gcc-89f528df98c041a719fc7ccbf2f7dd0f8448cdb0.zip |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118338 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 1f51fd09fca..d2da0d845c3 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; |