aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-expr.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2004-08-25 16:50:13 +0000
committerPaul Brook <pbrook@gcc.gnu.org>2004-08-25 16:50:13 +0000
commit40f201864ffd59ee5936db9ba75bc918227a6798 (patch)
tree894c624fd13417c22a3668caf4fef82e9246c6b6 /gcc/fortran/trans-expr.c
parent923ab88cb2f07d36569c71cf53f8a0529ca1c2d4 (diff)
downloadgcc-40f201864ffd59ee5936db9ba75bc918227a6798.zip
gcc-40f201864ffd59ee5936db9ba75bc918227a6798.tar.gz
gcc-40f201864ffd59ee5936db9ba75bc918227a6798.tar.bz2
re PR fortran/17144 (Not Implemented: Character string array constructors / Assignment to char array)
PR fortran/17144 * trans-array.c (gfc_trans_allocate_temp_array): Remove string_length argument. (gfc_trans_array_ctor_element): New function. (gfc_trans_array_constructor_subarray): Use it. (gfc_trans_array_constructor_value): Ditto. Handle constant character arrays. (get_array_ctor_var_strlen, get_array_ctor_strlen): New functions. (gfc_trans_array_constructor): Use them. (gfc_add_loop_ss_code): Update to new gfc_ss layout. (gfc_conv_ss_descriptor): Remember section string length. (gfc_conv_scalarized_array_ref): Ditto. Remove dead code. (gfc_conv_resolve_dependencies): Update to new gfc_ss layout. (gfc_conv_expr_descriptor): Ditto. (gfc_conv_loop_setup): Ditto. Spelling fixes. * trans-array.h (gfc_trans_allocate_temp_array): Update prototype. * trans-const.c (gfc_conv_constant): Update to new gfc_ss layout. * trans-expr.c (gfc_conv_component_ref): Turn error into ICE. (gfc_conv_variable): Set string_length from section. (gfc_conv_function_call): Remove extra argument. (gfc_conv_expr, gfc_conv_expr_reference): Update to new gfc_ss layout. * trans-types.c (gfc_get_character_type_len): New function. (gfc_get_character_type): Use it. (gfc_get_dtype): Return zero for internal types. * trans-types.h (gfc_get_character_type_len): Add prototype. * trans.h (struct gfc_ss): Move string_length out of union. testsuite/ * gfortran.dg/string_ctor_1.f90: New test. From-SVN: r86558
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r--gcc/fortran/trans-expr.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 50aa9ca..cbf2dd1 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -231,9 +231,8 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref)
if (c->ts.type == BT_CHARACTER)
{
tmp = c->ts.cl->backend_decl;
- assert (tmp);
- if (!INTEGER_CST_P (tmp))
- gfc_todo_error ("Unknown length character component");
+ /* Components must always be constant length. */
+ assert (tmp && INTEGER_CST_P (tmp));
se->string_length = tmp;
}
@@ -260,6 +259,7 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr)
/* A scalarized term. We already know the descriptor. */
se->expr = se->ss->data.info.descriptor;
+ se->string_length = se->ss->string_length;
ref = se->ss->data.info.ref;
}
else
@@ -1040,7 +1040,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
tmp = gfc_typenode_for_spec (&sym->ts);
info->dimen = se->loop->dimen;
/* Allocate a temporary to store the result. */
- gfc_trans_allocate_temp_array (se->loop, info, tmp, NULL_TREE);
+ gfc_trans_allocate_temp_array (se->loop, info, tmp);
/* Zero the first stride to indicate a temporary. */
tmp =
@@ -1711,7 +1711,7 @@ gfc_conv_expr (gfc_se * se, gfc_expr * expr)
/* Substitute a scalar expression evaluated outside the scalarization
loop. */
se->expr = se->ss->data.scalar.expr;
- se->string_length = se->ss->data.scalar.string_length;
+ se->string_length = se->ss->string_length;
gfc_advance_se_ss_chain (se);
return;
}
@@ -1799,7 +1799,7 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * expr)
&& se->ss->type == GFC_SS_REFERENCE)
{
se->expr = se->ss->data.scalar.expr;
- se->string_length = se->ss->data.scalar.string_length;
+ se->string_length = se->ss->string_length;
gfc_advance_se_ss_chain (se);
return;
}