aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/primary.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/primary.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/primary.c')
-rw-r--r--gcc/fortran/primary.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 1dd8626..9982b61 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -281,6 +281,7 @@ match_hollerith_constant (gfc_expr ** result)
gfc_default_character_kind, &gfc_current_locus);
e->value.character.string = gfc_getmem (num+1);
memcpy (e->value.character.string, buffer, num);
+ e->value.character.string[num] = '\0';
e->value.character.length = num;
*result = e;
return MATCH_YES;