aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-io.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>2006-06-03 19:28:33 +0200
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2006-06-03 17:28:33 +0000
commitdd18a33bd9bc113f3c21afc271c7d08f53635644 (patch)
tree2bd078734b2fda2d0a8face0efc809fc5f9589ef /gcc/fortran/trans-io.c
parent4f3d90548b4590281766091564da0bb23515af75 (diff)
downloadgcc-dd18a33bd9bc113f3c21afc271c7d08f53635644.zip
gcc-dd18a33bd9bc113f3c21afc271c7d08f53635644.tar.gz
gcc-dd18a33bd9bc113f3c21afc271c7d08f53635644.tar.bz2
trans.c (gfc_msg_bounds, [...]): Add strings for common runtime error messages.
* trans.c (gfc_msg_bounds, gfc_msg_fault, gfc_msg_wrong_return): Add strings for common runtime error messages. (gfc_trans_runtime_check): Add a locus argument, use a string and not a string tree for the message. * trans.h (gfc_trans_runtime_check): Change prototype accordingly. (gfc_msg_bounds, gfc_msg_fault, gfc_msg_wrong_return): Add proto. * trans-const.c (gfc_strconst_bounds, gfc_strconst_fault, gfc_strconst_wrong_return, gfc_strconst_current_filename): Remove. (gfc_init_constants): Likewise. * trans-const.h: Likewise. * trans-decl.c (gfc_build_builtin_function_decls): Call to _gfortran_runtime_error has only one argument, the message string. * trans-array.h (gfc_conv_array_ref): Add a symbol argument and a locus. * trans-array.c (gfc_trans_array_bound_check): Build precise error messages. (gfc_conv_array_ref): Use the new symbol argument and the locus to build more precise error messages. (gfc_conv_ss_startstride): More precise error messages. * trans-expr.c (gfc_conv_variable): Give symbol reference and locus to gfc_conv_array_ref. (gfc_conv_function_call): Use the new prototype for gfc_trans_runtime_check. * trans-stmt.c (gfc_trans_goto): Build more precise error message. * trans-io.c (set_string): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_bound): Use new prototype for gfc_trans_runtime_check. From-SVN: r114346
Diffstat (limited to 'gcc/fortran/trans-io.c')
-rw-r--r--gcc/fortran/trans-io.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index b4c83f4..e562321 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -518,7 +518,6 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var,
{
gfc_se se;
tree tmp;
- tree msg;
tree io;
tree len;
gfc_st_parameter_field *p = &st_parameter_field[type];
@@ -536,13 +535,18 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var,
/* Integer variable assigned a format label. */
if (e->ts.type == BT_INTEGER && e->symtree->n.sym->attr.assign == 1)
{
+ char * msg;
+
gfc_conv_label_variable (&se, e);
- msg =
- gfc_build_cstring_const ("Assigned label is not a format label");
tmp = GFC_DECL_STRING_LEN (se.expr);
tmp = fold_build2 (LT_EXPR, boolean_type_node,
tmp, build_int_cst (TREE_TYPE (tmp), 0));
- gfc_trans_runtime_check (tmp, msg, &se.pre);
+
+ asprintf(&msg, "Label assigned to variable '%s' is not a format label",
+ e->symtree->name);
+ gfc_trans_runtime_check (tmp, msg, &se.pre, &e->where);
+ gfc_free (msg);
+
gfc_add_modify_expr (&se.pre, io,
fold_convert (TREE_TYPE (io), GFC_DECL_ASSIGN_ADDR (se.expr)));
gfc_add_modify_expr (&se.pre, len, GFC_DECL_STRING_LEN (se.expr));