------- Comment #27 from pault at gcc dot gnu dot org 2007-10-10 07:05 -------
(In reply to comment #17)
> char.3 = (*(char[0:][1:1] *) atmp.0.data)[S.2][1]{lb: 1 sz: 1};
> (*(char[0:][1:1] *) atmp.1.data)[S.2] = char.3;
> the first line is correct, the second is not.
For the record, the patch at the end produces:
char char.3[1:1];
char.3[1]{lb: 1 sz: 1} = (*(char[0:][1:1] *)
atmp.0.data)[S.2][1]{lb
: 1 sz: 1};
(*(char[0:][1:1] *) atmp.1.data)[S.2] = char.3[1]{lb: 1 sz: 1};
which is nearly there. The lhs of the bottom line now needs to be the first
element of the string; ie. (*(char[0:][1:1] *) atmp.1.data)[S.2][1] and we will
be there. The problem is that I cannot figure out yet where the assignment
occurs, in order to do anything with the lhs!
Paul
Index: gcc/fortran/trans-intrinsic.c
===================================================================
*** gcc/fortran/trans-intrinsic.c (révision 129121)
--- gcc/fortran/trans-intrinsic.c (copie de travail)
*************** gfc_conv_intrinsic_char (gfc_se * se, gf
*** 1278,1297 ****
tree arg;
tree var;
tree type;
gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
/* We currently don't support character types != 1. */
gcc_assert (expr->ts.kind == 1);
! type = gfc_character1_type_node;
var = gfc_create_var (type, "char");
! arg = convert (type, arg);
! gfc_add_modify_expr (&se->pre, var, arg);
! se->expr = gfc_build_addr_expr (build_pointer_type (type), var);
se->string_length = integer_one_node;
}
-
static void
gfc_conv_intrinsic_ctime (gfc_se * se, gfc_expr * expr)
--- 1278,1298 ----
tree arg;
tree var;
tree type;
+ tree elem;
gfc_conv_intrinsic_function_args (se, expr, &arg, 1);
/* We currently don't support character types != 1. */
gcc_assert (expr->ts.kind == 1);
! type = gfc_typenode_for_spec (&expr->ts);
var = gfc_create_var (type, "char");
! arg = convert (gfc_character1_type_node, arg);
! elem = gfc_build_array_ref (var, gfc_index_one_node, NULL);
! gfc_add_modify_expr (&se->pre, elem, arg);
! se->expr = gfc_build_addr_expr (pchar_type_node, elem);
se->string_length = integer_one_node;
}
static void
gfc_conv_intrinsic_ctime (gfc_se * se, gfc_expr * expr)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31608