aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/data.c
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2010-08-27 06:50:03 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2010-08-27 06:50:03 +0000
commit401fcd3b8fd7158703263fd4de33a23faa7a2738 (patch)
treeb23e60e3b6c1de5d17cec4f6a741db7d30a1e5bf /gcc/fortran/data.c
parent9f8f1def9dd5d303a437397c5e1aaa60aef468d9 (diff)
downloadgcc-401fcd3b8fd7158703263fd4de33a23faa7a2738.zip
gcc-401fcd3b8fd7158703263fd4de33a23faa7a2738.tar.gz
gcc-401fcd3b8fd7158703263fd4de33a23faa7a2738.tar.bz2
re PR fortran/43217 (Output of Hollerith constants which are not a multiple of 4 bytes)
2010-08-27 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/43217 * primary.c (match_hollerith_constant): Calculate padding needed to fill default integer and allocate string for that size. Set pad bytes to ' '. * gfortran.h: Add hollerith pad value to type spec union. * data.c (create_character_initializer): Fix spelling of function name. Use hollerith pad value to calculate length. * arith.c (hollerith2representation); Use hollerith pad value to calculate length. From-SVN: r163581
Diffstat (limited to 'gcc/fortran/data.c')
-rw-r--r--gcc/fortran/data.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c
index 6829fe9..b1cfd6e 100644
--- a/gcc/fortran/data.c
+++ b/gcc/fortran/data.c
@@ -100,8 +100,8 @@ find_con_by_component (gfc_component *com, gfc_constructor_base base)
according to normal assignment rules. */
static gfc_expr *
-create_character_intializer (gfc_expr *init, gfc_typespec *ts,
- gfc_ref *ref, gfc_expr *rvalue)
+create_character_initializer (gfc_expr *init, gfc_typespec *ts,
+ gfc_ref *ref, gfc_expr *rvalue)
{
int len, start, end;
gfc_char_t *dest;
@@ -149,7 +149,7 @@ create_character_intializer (gfc_expr *init, gfc_typespec *ts,
/* Copy the initial value. */
if (rvalue->ts.type == BT_HOLLERITH)
- len = rvalue->representation.length;
+ len = rvalue->representation.length - rvalue->ts.u.pad;
else
len = rvalue->value.character.length;
@@ -342,7 +342,7 @@ gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index)
{
if (lvalue->ts.u.cl->length == NULL && !(ref && ref->u.ss.length != NULL))
return FAILURE;
- expr = create_character_intializer (init, last_ts, ref, rvalue);
+ expr = create_character_initializer (init, last_ts, ref, rvalue);
}
else
{