aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-intrinsic.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2007-08-10 22:12:04 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2007-08-10 22:12:04 +0000
commitc8fe94c7ea3debcf5b41cfabfe0ca395b1834da4 (patch)
tree0df09be0cf775be5c5fc3736c8d20336d1c06fe9 /gcc/fortran/trans-intrinsic.c
parentac2610bf4275ca4edec63ccc0f6ee53309c639c1 (diff)
downloadgcc-c8fe94c7ea3debcf5b41cfabfe0ca395b1834da4.zip
gcc-c8fe94c7ea3debcf5b41cfabfe0ca395b1834da4.tar.gz
gcc-c8fe94c7ea3debcf5b41cfabfe0ca395b1834da4.tar.bz2
re PR fortran/31270 (print subscript value and array bounds when out-of-bounds error occurs)
PR fortran/31270 * trans.c (gfc_trans_runtime_check): Reorder arguments and add extra variable arguments. Hand them to the library function. * trans.h (gfc_trans_runtime_check): Update prototype. * trans-array.c (gfc_trans_array_bound_check): Issue more detailled error messages. (gfc_conv_array_ref): Likewise. (gfc_conv_ss_startstride): Likewise. (gfc_trans_dummy_array_bias): Reorder arguments to gfc_trans_runtime_check. * trans-expr.c (gfc_conv_substring): Issue more detailled error messages. (gfc_conv_function_call): Reorder arguments to gfc_trans_runtime_check. * trans-stmt.c (gfc_trans_goto): Likewise. * trans-io.c (set_string): Reorder arguments to gfc_trans_runtime_check and issue a more detailled error message. * trans-decl.c (gfc_build_builtin_function_decls): Make runtime_error and runtime_error_at handle a variable number of arguments. * trans-intrinsic.c (gfc_conv_intrinsic_bound): Reorder arguments to gfc_trans_runtime_check. (gfc_conv_intrinsic_minmax): Likewise. (gfc_conv_intrinsic_repeat): Issue more detailled error messages. * runtime/error.c (runtime_error_at): Add a variable number of arguments. * libgfortran.h (runtime_error_at): Update prototype. From-SVN: r127352
Diffstat (limited to 'gcc/fortran/trans-intrinsic.c')
-rw-r--r--gcc/fortran/trans-intrinsic.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 8849e44..b9dbf46 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -855,7 +855,7 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, int upper)
tmp = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (TREE_TYPE (desc))];
tmp = fold_build2 (GE_EXPR, boolean_type_node, bound, tmp);
cond = fold_build2 (TRUTH_ORIF_EXPR, boolean_type_node, cond, tmp);
- gfc_trans_runtime_check (cond, gfc_msg_fault, &se->pre, &expr->where);
+ gfc_trans_runtime_check (cond, &se->pre, &expr->where, gfc_msg_fault);
}
}
@@ -1485,7 +1485,7 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, int op)
expr->symtree->n.sym->name);
cond = build2 (EQ_EXPR, boolean_type_node, TREE_OPERAND (args[0], 0),
build_int_cst (TREE_TYPE (TREE_OPERAND (args[0], 0)), 0));
- gfc_trans_runtime_check (cond, msg, &se->pre, &expr->where);
+ gfc_trans_runtime_check (cond, &se->pre, &expr->where, msg);
gfc_free (msg);
}
@@ -1501,7 +1501,7 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, int op)
expr->symtree->n.sym->name);
cond = build2 (EQ_EXPR, boolean_type_node, TREE_OPERAND (args[1], 0),
build_int_cst (TREE_TYPE (TREE_OPERAND (args[1], 0)), 0));
- gfc_trans_runtime_check (cond, msg, &se->pre, &expr->where);
+ gfc_trans_runtime_check (cond, &se->pre, &expr->where, msg);
gfc_free (msg);
}
@@ -3665,9 +3665,10 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr)
/* Check that NCOPIES is not negative. */
cond = fold_build2 (LT_EXPR, boolean_type_node, ncopies,
build_int_cst (ncopies_type, 0));
- gfc_trans_runtime_check (cond,
- "Argument NCOPIES of REPEAT intrinsic is negative",
- &se->pre, &expr->where);
+ gfc_trans_runtime_check (cond, &se->pre, &expr->where,
+ "Argument NCOPIES of REPEAT intrinsic is negative "
+ "(its value is %lld)",
+ fold_convert (long_integer_type_node, ncopies));
/* If the source length is zero, any non negative value of NCOPIES
is valid, and nothing happens. */
@@ -3696,9 +3697,9 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr)
build_int_cst (size_type_node, 0));
cond = fold_build3 (COND_EXPR, boolean_type_node, tmp, boolean_false_node,
cond);
- gfc_trans_runtime_check (cond,
- "Argument NCOPIES of REPEAT intrinsic is too large",
- &se->pre, &expr->where);
+ gfc_trans_runtime_check (cond, &se->pre, &expr->where,
+ "Argument NCOPIES of REPEAT intrinsic is too large");
+
/* Compute the destination length. */
dlen = fold_build2 (MULT_EXPR, gfc_charlen_type_node,