aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-array.c
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2014-12-31 15:50:10 +0100
committerUros Bizjak <uros@gcc.gnu.org>2014-12-31 15:50:10 +0100
commit1a33dc9ec24fed0406de07f54e0442915e3cfedb (patch)
tree5b0e17f5acd2cb905b0d28cea526ba21ab59c791 /gcc/fortran/trans-array.c
parente8ef82d74f40e216b3a1c9707a79a3bd0b6c953d (diff)
downloadgcc-1a33dc9ec24fed0406de07f54e0442915e3cfedb.zip
gcc-1a33dc9ec24fed0406de07f54e0442915e3cfedb.tar.gz
gcc-1a33dc9ec24fed0406de07f54e0442915e3cfedb.tar.bz2
trans-array.c (trans_array_bound_check): Use xasprintf instead of unchecked asprintf.
* trans-array.c (trans_array_bound_check): Use xasprintf instead of unchecked asprintf. (gfc_conv_array_ref): Ditto. (gfc_conv_ss_startstride): Ditto. (gfc_trans_dummy_array_bias): Ditto. (gfc_conv_array_parameter): Ditto. * trans-decl.c (gfc_generate_function_code): Ditto. * trans-expr.c (gfc_conv_substring): Ditto. (gfc_conv_procedure_call): Ditto. * trans-io.c (gfc_trans_io_runtime_check): Ditto. (set_string): Ditto. * trans.c (trans-runtime_error_vararg): Ditto. From-SVN: r219126
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r--gcc/fortran/trans-array.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index ebd7f11..07a9873 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -2799,11 +2799,11 @@ trans_array_bound_check (gfc_se * se, gfc_ss *ss, tree index, int n,
tmp_up = gfc_conv_array_ubound (descriptor, n);
if (name)
- asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
- "outside of expected range (%%ld:%%ld)", n+1, name);
+ msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
+ "outside of expected range (%%ld:%%ld)", n+1, name);
else
- asprintf (&msg, "Index '%%ld' of dimension %d "
- "outside of expected range (%%ld:%%ld)", n+1);
+ msg = xasprintf ("Index '%%ld' of dimension %d "
+ "outside of expected range (%%ld:%%ld)", n+1);
fault = fold_build2_loc (input_location, LT_EXPR, boolean_type_node,
index, tmp_lo);
@@ -2824,11 +2824,11 @@ trans_array_bound_check (gfc_se * se, gfc_ss *ss, tree index, int n,
tmp_lo = gfc_conv_array_lbound (descriptor, n);
if (name)
- asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
- "below lower bound of %%ld", n+1, name);
+ msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
+ "below lower bound of %%ld", n+1, name);
else
- asprintf (&msg, "Index '%%ld' of dimension %d "
- "below lower bound of %%ld", n+1);
+ msg = xasprintf ("Index '%%ld' of dimension %d "
+ "below lower bound of %%ld", n+1);
fault = fold_build2_loc (input_location, LT_EXPR, boolean_type_node,
index, tmp_lo);
@@ -3259,8 +3259,8 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_expr *expr,
cond = fold_build2_loc (input_location, LT_EXPR, boolean_type_node,
indexse.expr, tmp);
- asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
- "below lower bound of %%ld", n+1, var_name);
+ msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
+ "below lower bound of %%ld", n+1, var_name);
gfc_trans_runtime_check (true, false, cond, &se->pre, where, msg,
fold_convert (long_integer_type_node,
indexse.expr),
@@ -3283,8 +3283,8 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_expr *expr,
cond = fold_build2_loc (input_location, GT_EXPR,
boolean_type_node, indexse.expr, tmp);
- asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
- "above upper bound of %%ld", n+1, var_name);
+ msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
+ "above upper bound of %%ld", n+1, var_name);
gfc_trans_runtime_check (true, false, cond, &se->pre, where, msg,
fold_convert (long_integer_type_node,
indexse.expr),
@@ -3981,8 +3981,8 @@ done:
/* Zero stride is not allowed. */
tmp = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node,
info->stride[dim], gfc_index_zero_node);
- asprintf (&msg, "Zero stride is not allowed, for dimension %d "
- "of array '%s'", dim + 1, expr_name);
+ msg = xasprintf ("Zero stride is not allowed, for dimension %d "
+ "of array '%s'", dim + 1, expr_name);
gfc_trans_runtime_check (true, false, tmp, &inner,
expr_loc, msg);
free (msg);
@@ -4039,9 +4039,9 @@ done:
tmp2 = fold_build2_loc (input_location, TRUTH_AND_EXPR,
boolean_type_node,
non_zerosized, tmp2);
- asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
- "outside of expected range (%%ld:%%ld)",
- dim + 1, expr_name);
+ msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
+ "outside of expected range (%%ld:%%ld)",
+ dim + 1, expr_name);
gfc_trans_runtime_check (true, false, tmp, &inner,
expr_loc, msg,
fold_convert (long_integer_type_node, info->start[dim]),
@@ -4061,9 +4061,9 @@ done:
info->start[dim], lbound);
tmp = fold_build2_loc (input_location, TRUTH_AND_EXPR,
boolean_type_node, non_zerosized, tmp);
- asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
- "below lower bound of %%ld",
- dim + 1, expr_name);
+ msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
+ "below lower bound of %%ld",
+ dim + 1, expr_name);
gfc_trans_runtime_check (true, false, tmp, &inner,
expr_loc, msg,
fold_convert (long_integer_type_node, info->start[dim]),
@@ -4093,9 +4093,9 @@ done:
boolean_type_node, tmp, ubound);
tmp3 = fold_build2_loc (input_location, TRUTH_AND_EXPR,
boolean_type_node, non_zerosized, tmp3);
- asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
- "outside of expected range (%%ld:%%ld)",
- dim + 1, expr_name);
+ msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
+ "outside of expected range (%%ld:%%ld)",
+ dim + 1, expr_name);
gfc_trans_runtime_check (true, false, tmp2, &inner,
expr_loc, msg,
fold_convert (long_integer_type_node, tmp),
@@ -4110,9 +4110,9 @@ done:
}
else
{
- asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' "
- "below lower bound of %%ld",
- dim + 1, expr_name);
+ msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
+ "below lower bound of %%ld",
+ dim + 1, expr_name);
gfc_trans_runtime_check (true, false, tmp2, &inner,
expr_loc, msg,
fold_convert (long_integer_type_node, tmp),
@@ -4139,9 +4139,9 @@ done:
{
tmp3 = fold_build2_loc (input_location, NE_EXPR,
boolean_type_node, tmp, size[n]);
- asprintf (&msg, "Array bound mismatch for dimension %d "
- "of array '%s' (%%ld/%%ld)",
- dim + 1, expr_name);
+ msg = xasprintf ("Array bound mismatch for dimension %d "
+ "of array '%s' (%%ld/%%ld)",
+ dim + 1, expr_name);
gfc_trans_runtime_check (true, false, tmp3, &inner,
expr_loc, msg,
@@ -6013,8 +6013,8 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc,
gfc_index_one_node, stride2);
tmp = fold_build2_loc (input_location, NE_EXPR,
gfc_array_index_type, temp, stride2);
- asprintf (&msg, "Dimension %d of array '%s' has extent "
- "%%ld instead of %%ld", n+1, sym->name);
+ msg = xasprintf ("Dimension %d of array '%s' has extent "
+ "%%ld instead of %%ld", n+1, sym->name);
gfc_trans_runtime_check (true, false, tmp, &init, &loc, msg,
fold_convert (long_integer_type_node, temp),
@@ -7292,10 +7292,10 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, bool g77,
char * msg;
if (fsym && proc_name)
- asprintf (&msg, "An array temporary was created for argument "
- "'%s' of procedure '%s'", fsym->name, proc_name);
+ msg = xasprintf ("An array temporary was created for argument "
+ "'%s' of procedure '%s'", fsym->name, proc_name);
else
- asprintf (&msg, "An array temporary was created");
+ msg = xasprintf ("An array temporary was created");
tmp = build_fold_indirect_ref_loc (input_location,
desc);