[Patch Modified] re: Enable Hollerith constant and character arrayin format tag (take 3).
Steven Bosscher
stevenb@suse.de
Mon Jul 4 11:11:00 GMT 2005
On Friday 01 July 2005 12:13, Feng Wang wrote:
> Handle allocatable array assiged Hollerith constant and more test.
>
> Please remove the diff on trans-io.c in the patch:
> http://gcc.gnu.org/ml/fortran/2005-06/msg00475.html
> And use this diff attached.
Wrt. http://gcc.gnu.org/ml/gcc-patches/2005-06/msg02163.html I only
have one remark:
> ! /* Numeric can be converted to any other numeric. And Hollerith can be
> ! converted to any other type. */
> ! if ((gfc_numeric_ts (&lvalue->ts) && gfc_numeric_ts (&rvalue->ts))
> ! || rvalue->ts.type == BT_HOLLERITH)
> return SUCCESS;
Please use proper indentation. The rest looks reasonable to me. Could
someone double-check the io.c changes please?
For http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00020.html there are
a few more things that look just wrong:
> + gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
> + size = gfc_conv_array_stride (array, rank);
> + tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type,
> + gfc_conv_array_ubound (array, rank),
> + gfc_conv_array_lbound (array, rank));
> + tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, tmp,
> + gfc_index_one_node);
> + size = fold_build2 (MULT_EXPR, gfc_array_index_type, tmp, size);
This can't be right. gfc_conv_array_stride returns a COMPONENT_REF,
so the last line here tries to multiply gfc_array_index_type and a
COMPONENT_REF. Very Wrong thing to do.
> *************** set_string (stmtblock_t * block, stmtblo
> *** 400,406 ****
> }
> else
> {
> ! gfc_conv_expr (&se, e);
> gfc_conv_string_parameter (&se);
> gfc_add_modify_expr (&se.pre, io, fold_convert (TREE_TYPE (io), se.expr));
> gfc_add_modify_expr (&se.pre, len, se.string_length);
> --- 462,474 ----
> }
> else
> {
> ! /* General character. */
> ! if (e->ts.type == BT_CHARACTER && e->rank == 0)
> ! gfc_conv_expr (&se, e);
> ! /* Array assigned Hollerith constant or character array. */
> ! else if (e->symtree && (e->symtree->n.sym->as->rank > 0))
> ! gfc_convert_array_to_string (&se, e);
You should add an extra "else gcc_unreachable ()" clause.
> !
> gfc_conv_string_parameter (&se);
> gfc_add_modify_expr (&se.pre, io, fold_convert (TREE_TYPE (io), se.expr));
> gfc_add_modify_expr (&se.pre, len, se.string_length);
Thanks for working on this.
Gr.
Steven
More information about the Fortran
mailing list