diff options
author | brooks <brooks@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-05-28 18:20:29 +0000 |
---|---|---|
committer | brooks <brooks@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-05-28 18:20:29 +0000 |
commit | 667787ce6e465c8d52b61e01e0a6398cb48abc51 (patch) | |
tree | 285e1933957cc1ea01f2d184aeb1656b76b6b3cb /gcc/fortran/data.c | |
parent | 4a17ac7b10f917cbec5105f80645100f34dec47e (diff) | |
download | gcc-667787ce6e465c8d52b61e01e0a6398cb48abc51.tar.gz |
* gfortran.h (gfc_expr): Remove from_H, add "representation"
struct.
* primary.c (match_hollerith_constant): Store the representation
of the Hollerith in representation, not in value.character.
* arith.c: Add dependency on target-memory.h.
(eval_intrinsic): Remove check for from_H.
(hollerith2representation): New function.
(gfc_hollerith2int): Determine value of the new constant.
(gfc_hollerith2real): Likewise.
(gfc_hollerith2complex): Likewise.
(gfc_hollerith2logical): Likewise.
(gfc_hollerith2character): Point both representation.string and
value.character.string at the value string.
* data.c (create_character_initializer): For BT_HOLLERITH
rvalues, get the value from the representation rather than
value.character.
* expr.c (free_expr0): Update handling of BT_HOLLERITH values
and values with representation.string.
(gfc_copy_expr): Likewise.
* intrinsic.c (do_simplify): Remove special treatement of
variables resulting from Hollerith constants.
* dump-parse-trees.c (gfc_show_expr): Update handling of
Holleriths.
* trans-const.c (gfc_conv_constant_to_tree): Replace from_H
check with check for representation.string; get Hollerith
representation from representation.string, not value.character.
* trans-expr.c (is_zero_initializer_p): Replace from_H check
with check for representation.string.
* trans-stmt.c (gfc_trans_integer_select): Use
gfc_conv_mpz_to_tree for case values, so as to avoid picking up
the memory representation if the case is given by a transfer
expression.
* target-memory.c (gfc_target_encode_expr): Use the known memory
representation rather than the value, if it exists.
(gfc_target_interpret_expr): Store the memory representation of
the interpreted expression as well as its value.
(interpret_integer): Move to gfc_interpret_integer, make
non-static.
(interpret_float): Move to gfc_interpret_float, make non-static.
(interpret_complex): Move to gfc_interpret_complex, make
non-static.
(interpret_logical): Move to gfc_interpret_logical, make
non-static.
(interpret_character): Move to gfc_interpret_character, make
non-static.
(interpret_derived): Move to gfc_interpret_derived, make
non-static.
* target-memory.h: Add prototypes for newly-exported
gfc_interpret_* functions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125135 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/data.c')
-rw-r--r-- | gcc/fortran/data.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c index 70a715127df..75e4241e059 100644 --- a/gcc/fortran/data.c +++ b/gcc/fortran/data.c @@ -154,7 +154,7 @@ create_character_intializer (gfc_expr *init, gfc_typespec *ts, int len; int start; int end; - char *dest; + char *dest, *rvalue_string; gfc_extract_int (ts->cl->length, &len); @@ -207,7 +207,17 @@ create_character_intializer (gfc_expr *init, gfc_typespec *ts, } /* Copy the initial value. */ - len = rvalue->value.character.length; + if (rvalue->ts.type == BT_HOLLERITH) + { + len = rvalue->representation.length; + rvalue_string = rvalue->representation.string; + } + else + { + len = rvalue->value.character.length; + rvalue_string = rvalue->value.character.string; + } + if (len > end - start) { len = end - start; @@ -215,14 +225,17 @@ create_character_intializer (gfc_expr *init, gfc_typespec *ts, "at %L", &rvalue->where); } - memcpy (&dest[start], rvalue->value.character.string, len); + memcpy (&dest[start], rvalue_string, len); /* Pad with spaces. Substrings will already be blanked. */ if (len < end - start && ref == NULL) memset (&dest[start + len], ' ', end - (start + len)); if (rvalue->ts.type == BT_HOLLERITH) - init->from_H = 1; + { + init->representation.length = init->value.character.length; + init->representation.string = init->value.character.string; + } return init; } |