/* Generate code to perform an array index bound check. */
static tree
-trans_array_bound_check (gfc_se * se, gfc_ss *ss, tree index, int n,
+trans_array_bound_check (stmtblock_t *block, gfc_ss *ss, tree index, int n,
locus * where, bool check_upper,
const char *compname = NULL)
{
descriptor = ss->info->data.array.descriptor;
- index = gfc_evaluate_now (index, &se->pre);
+ index = gfc_evaluate_now (index, block);
/* We find a name for the error message. */
name = ss->info->expr->symtree->n.sym->name;
fault = fold_build2_loc (input_location, LT_EXPR, logical_type_node,
index, tmp_lo);
- gfc_trans_runtime_check (true, false, fault, &se->pre, where, msg,
+ gfc_trans_runtime_check (true, false, fault, block, where, msg,
fold_convert (long_integer_type_node, index),
fold_convert (long_integer_type_node, tmp_lo),
fold_convert (long_integer_type_node, tmp_up));
fault = fold_build2_loc (input_location, GT_EXPR, logical_type_node,
index, tmp_up);
- gfc_trans_runtime_check (true, false, fault, &se->pre, where, msg,
+ gfc_trans_runtime_check (true, false, fault, block, where, msg,
fold_convert (long_integer_type_node, index),
fold_convert (long_integer_type_node, tmp_lo),
fold_convert (long_integer_type_node, tmp_up));
fault = fold_build2_loc (input_location, LT_EXPR, logical_type_node,
index, tmp_lo);
- gfc_trans_runtime_check (true, false, fault, &se->pre, where, msg,
+ gfc_trans_runtime_check (true, false, fault, block, where, msg,
fold_convert (long_integer_type_node, index),
fold_convert (long_integer_type_node, tmp_lo));
free (msg);
/* Generate code for bounds checking for elemental dimensions. */
static void
-array_bound_check_elemental (gfc_se * se, gfc_ss * ss, gfc_expr * expr)
+array_bound_check_elemental (stmtblock_t *block, gfc_ss * ss, gfc_expr * expr)
{
gfc_array_ref *ar;
gfc_ref *ref;
gfc_init_se (&indexse, NULL);
gfc_conv_expr_type (&indexse, ar->start[dim],
gfc_array_index_type);
- gfc_add_block_to_block (&se->pre, &indexse.pre);
- trans_array_bound_check (se, ss, indexse.expr, dim,
+ gfc_add_block_to_block (block, &indexse.pre);
+ trans_array_bound_check (block, ss, indexse.expr, dim,
&ar->where,
ar->as->type != AS_ASSUMED_SIZE
|| dim < ar->dimen - 1,
/* We've already translated this value outside the loop. */
index = info->subscript[dim]->info->data.scalar.value;
- index = trans_array_bound_check (se, ss, index, dim, &ar->where,
+ index = trans_array_bound_check (&se->pre, ss, index, dim, &ar->where,
ar->as->type != AS_ASSUMED_SIZE
|| dim < ar->dimen - 1);
break;
index = fold_convert (gfc_array_index_type, index);
/* Do any bounds checking on the final info->descriptor index. */
- index = trans_array_bound_check (se, ss, index, dim, &ar->where,
+ index = trans_array_bound_check (&se->pre, ss, index, dim, &ar->where,
ar->as->type != AS_ASSUMED_SIZE
|| dim < ar->dimen - 1);
break;
/* Add bounds-checking for elemental dimensions. */
if ((gfc_option.rtcheck & GFC_RTCHECK_BOUNDS) && !expr->no_bounds_check)
- array_bound_check_elemental (se, ss, expr);
+ array_bound_check_elemental (&se->pre, ss, expr);
if (need_tmp)
{